View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002967 | FSSCP | modular tables | public | 2013-11-30 22:55 | 2013-12-01 16:06 |
Reporter | niffiwan | Assigned To | Yarn | ||
Priority | high | Severity | major | Reproducibility | have not tried |
Status | resolved | Resolution | fixed | ||
Product Version | 3.7.1 | ||||
Target Version | 3.7.2 | ||||
Summary | 0002967: possible negative array index read | ||||
Description | This is probably from Yarns persona specific debrief patch (although I haven't confirmed this) Reported by Coverity: ID 1134041 code/missionui/missiondebrief.cpp void debrief_award_init() 1. var_tested_neg: Assigning: "Promoted" = a negative value. 983 Promoted = -1; .... CID 1134041 (0000001 of 1): Negative array index read (NEGATIVE_RETURNS)5. negative_returns: Using variable "Promoted" as an index to array "Ranks". 1029 if (Ranks[Promoted].promotion_text.find(persona_index) != Ranks[Promoted].promotion_text.end()) { 1030 Badge_stage.text = Medals[Player->stats.m_badge_earned].promotion_text[persona_index]; 1031 } else { 1032 Badge_stage.text = Medals[Player->stats.m_badge_earned].promotion_text[-1]; 1033 } (i.e. may manifest if a badge is awarded, but not a promotion) | ||||
Steps To Reproduce | needs to be confirmed | ||||
Tags | No tags attached. | ||||
|
Yes, this is caused by my patch. The problem appears to be in line 1029, where I evidently forgot to change it to read from the Medals array instead of Ranks. The attached patch should fix this. |
|
mantis2967.patch (801 bytes)
Index: code/missionui/missiondebrief.cpp =================================================================== --- code/missionui/missiondebrief.cpp (revision 10174) +++ code/missionui/missiondebrief.cpp (working copy) @@ -1026,7 +1026,7 @@ int persona_index = debrief_find_persona_index(); // use persona-specific badge text if it exists; otherwise, use default - if (Ranks[Promoted].promotion_text.find(persona_index) != Ranks[Promoted].promotion_text.end()) { + if (Medals[Player->stats.m_badge_earned].promotion_text.find(persona_index) != Medals[Player->stats.m_badge_earned].promotion_text.end()) { Badge_stage.text = Medals[Player->stats.m_badge_earned].promotion_text[persona_index]; } else { Badge_stage.text = Medals[Player->stats.m_badge_earned].promotion_text[-1]; |
|
Fix committed to trunk@10176. |
|
Crediting Yarn. |
Date Modified | Username | Field | Change |
---|---|---|---|
2013-11-30 22:55 | niffiwan | New Issue | |
2013-11-30 22:57 | niffiwan | Description Updated | |
2013-12-01 01:54 | Yarn | Note Added: 0015474 | |
2013-12-01 01:54 | Yarn | File Added: mantis2967.patch | |
2013-12-01 08:08 | niffiwan | Changeset attached | => fs2open trunk r10176 |
2013-12-01 08:08 | niffiwan | Note Added: 0015477 | |
2013-12-01 08:08 | niffiwan | Status | new => resolved |
2013-12-01 08:08 | niffiwan | Resolution | open => fixed |
2013-12-01 16:06 | Goober5000 | Note Added: 0015479 | |
2013-12-01 16:06 | Goober5000 | Assigned To | => Yarn |