View Issue Details

IDProjectCategoryView StatusLast Update
0003027FSSCPAIpublic2014-04-05 15:59
Reporterm_m Assigned Tom_m  
PrioritynormalSeveritycrashReproducibilityalways
Status resolvedResolutionfixed 
Product Version3.7.1 
Target Version3.7.2 
Summary0003027: Crash if ship AI is forced to change target
DescriptionIf a ship targets a subsystem and is forced to change the target by e.g. ignoring the set target can result in crash if the target change happens within the target delay time.
Steps To ReproduceHave a bomber target a capital ship subsystem and then ignore that ship when the bomber arrives in the mission.
Additional InformationThe uploaded patch fixes the crash by making sure that the return value of set_target_objnum is used when setting the new En_objp pointer.
TagsNo tags attached.

Activities

m_m

2014-04-05 15:55

developer  

aiCrash.patch (575 bytes)   
Index: code/ai/aicode.cpp
===================================================================
--- code/ai/aicode.cpp	(revision 10551)
+++ code/ai/aicode.cpp	(working copy)
@@ -14014,8 +14014,12 @@
 				if (target_objnum != -1) {
 					if (aip->target_objnum != target_objnum)
 						aip->aspect_locked_time = 0.0f;
-					set_target_objnum(aip, target_objnum);
-					En_objp = &Objects[target_objnum];
+					target_objnum = set_target_objnum(aip, target_objnum);
+
+					if (target_objnum >= 0)
+					{
+						En_objp = &Objects[target_objnum];
+					}
 				}
 			}
 		}
aiCrash.patch (575 bytes)   

m_m

2014-04-05 15:59

developer   ~0015697

Fix committed to trunk@10552.

Related Changesets

fs2open: trunk r10552

2014-04-05 11:05

m_m


Ported: N/A

Details Diff
Fix for Mantis 3027: Crash if ship AI is forced to change target Affected Issues
0003027
mod - /trunk/fs2_open/code/ai/aicode.cpp Diff File

Issue History

Date Modified Username Field Change
2014-04-05 15:55 m_m New Issue
2014-04-05 15:55 m_m Status new => assigned
2014-04-05 15:55 m_m Assigned To => m_m
2014-04-05 15:55 m_m File Added: aiCrash.patch
2014-04-05 15:56 m_m Status assigned => code review
2014-04-05 15:59 m_m Changeset attached => fs2open trunk r10552
2014-04-05 15:59 m_m Note Added: 0015697
2014-04-05 15:59 m_m Status code review => resolved
2014-04-05 15:59 m_m Resolution open => fixed