View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002900 | FSSCP | AI | public | 2013-07-07 12:06 | 2013-07-07 22:57 |
Reporter | Echelon9 | Assigned To | Echelon9 | ||
Priority | normal | Severity | major | Reproducibility | N/A |
Status | resolved | Resolution | fixed | ||
Product Version | 3.7.0 RC2 | ||||
Target Version | 3.7.0 | ||||
Summary | 0002900: Potential uninitialised AI code structures -- dangerous use of Num_objects | ||||
Description | Related to Mantis 2897, the use of Num_objects as an end point of range when walking through the Objects[] array is dangerous while we have a non-compacting garbage collection algorithm. It is possible that within init_ai_objects(), ships will have uninitialised AI information, particularly where a great many objects have been allocated and free'd. | ||||
Tags | No tags attached. | ||||
|
mantis-2900-preventative-fix.patch (349 bytes)
Index: code/ai/aicode.cpp =================================================================== --- code/ai/aicode.cpp (revision 9706) +++ code/ai/aicode.cpp (working copy) @@ -14080,7 +14080,7 @@ { int i; - for (i=0; i<Num_objects; i++){ + for (i=0; i<Highest_object_index; i++){ if (Objects[i].type == OBJ_SHIP){ init_ai_object(i); } |
|
Ready for code review |
|
As before, you would need to use Highest_object_index+1 or the <= operator. However, the funny thing is that that function isn't actually used anywhere. :p |
|
Resolving per commit. I also want to highly commend you for searching the codebase after having determined the cause of 0002897. Any time we solve a bug, it is a good idea to see if similar occurrences of the bug manifest themselves in other locations. Rarely, however, do people look for this. I am awarding you the Gold Star on the forums. :) |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-07-07 12:06 | Echelon9 | New Issue | |
2013-07-07 12:06 | Echelon9 | Status | new => assigned |
2013-07-07 12:06 | Echelon9 | Assigned To | => Echelon9 |
2013-07-07 12:06 | Echelon9 | Relationship added | related to 0002897 |
2013-07-07 12:26 | Echelon9 | File Added: mantis-2900-preventative-fix.patch | |
2013-07-07 12:26 | Echelon9 | Note Added: 0015167 | |
2013-07-07 12:26 | Echelon9 | Assigned To | Echelon9 => Goober5000 |
2013-07-07 12:26 | Echelon9 | Status | assigned => code review |
2013-07-07 22:54 | Goober5000 | Note Added: 0015171 | |
2013-07-07 22:55 | Goober5000 | Changeset attached | => fs2open trunk r9709 |
2013-07-07 22:57 | Goober5000 | Note Added: 0015172 | |
2013-07-07 22:57 | Goober5000 | Assigned To | Goober5000 => Echelon9 |
2013-07-07 22:57 | Goober5000 | Status | code review => resolved |
2013-07-07 22:57 | Goober5000 | Resolution | open => fixed |