View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0002132 | FSSCP | FRED | public | 2010-02-17 14:49 | 2010-03-19 06:47 |
Reporter | Evergreen | Assigned To | Genghis | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | resolved | Resolution | fixed | ||
Product Version | 3.6.10 | ||||
Fixed in Version | 3.6.12 RC2 | ||||
Summary | 0002132: FRED 3.6.10 crashes when cargo list is longer than 30 items | ||||
Description | A mission that contains more than 30 items in the Cargo list crashes FRED without a warning message. Though the Edit Ship box cannot be closed when "Num_cargo" is greater than "MAX_CARGO", clicking on "Prev" oder "Next" crsahes the client. Perhaps a proper warning dialogue should be included with a future build in order to prevent unneccessary data loss. | ||||
Additional Information | This is the error message that comes with it Assert: Num_cargo < MAX_CARGO File: shipeditordlg.cpp Line: 1525 Call stack: ------------------------------------------------------------------ fred2_open_3_6_10_RC2_debug.exe 00495f07() fred2_open_3_6_10_RC2_debug.exe 0049875d() fred2_open_3_6_10_RC2_debug.exe 009cb334() fred2_open_3_6_10_RC2_debug.exe 009cba61() fred2_open_3_6_10_RC2_debug.exe 009c1dd1() fred2_open_3_6_10_RC2_debug.exe 009c6d8b() fred2_open_3_6_10_RC2_debug.exe 004973c8() fred2_open_3_6_10_RC2_debug.exe 009c5fa1() fred2_open_3_6_10_RC2_debug.exe 009c5f24() fred2_open_3_6_10_RC2_debug.exe 009c3ac9() fred2_open_3_6_10_RC2_debug.exe 009c3f65() USER32.dll 76526238() USER32.dll 765268ea() USER32.dll 7652cd1a() USER32.dll 7652cd81() ------------------------------------------------------------------ | ||||
Tags | No tags attached. | ||||
2010-02-17 14:49
|
|
|
Ah, sorry for the long log, I didn't realize you could upload multiple files. |
2010-03-17 03:11
|
fix_2132.diff (822 bytes)
Index: fs2_open/code/fred2/shipeditordlg.cpp =================================================================== --- fs2_open/code/fred2/shipeditordlg.cpp (revision 6012) +++ fs2_open/code/fred2/shipeditordlg.cpp (working copy) @@ -1253,9 +1253,16 @@ if (strlen(m_cargo1)) { z = string_lookup(m_cargo1, Cargo_names, Num_cargo); if (z == -1) { - Assert(Num_cargo < MAX_CARGO); - z = Num_cargo++; - strcpy(Cargo_names[z], m_cargo1); + if (Num_cargo < MAX_CARGO) { + z = Num_cargo++; + strcpy(Cargo_names[z], m_cargo1); + } + else { + #define _QUOTE(x) #x + #define _QUOTEVAR(x) _QUOTE(x) + MessageBox("Maximum number of cargo names (" _QUOTEVAR(MAX_CARGO) ") reached.\n" + "Ignoring new name.\n", "Error", MB_ICONEXCLAMATION); + } } MODIFY(Ships[ship].cargo1, (char)z); |
|
I added a candidate fix, called fix_2132.diff. |
2010-03-17 13:34
|
fix_2132_v2.diff (735 bytes)
Index: code/fred2/shipeditordlg.cpp =================================================================== --- code/fred2/shipeditordlg.cpp (revision 6012) +++ code/fred2/shipeditordlg.cpp (working copy) @@ -1253,9 +1253,14 @@ if (strlen(m_cargo1)) { z = string_lookup(m_cargo1, Cargo_names, Num_cargo); if (z == -1) { - Assert(Num_cargo < MAX_CARGO); - z = Num_cargo++; - strcpy(Cargo_names[z], m_cargo1); + if (Num_cargo < MAX_CARGO) { + z = Num_cargo++; + strcpy(Cargo_names[z], m_cargo1); + } + else { + str.Format("Maximum number of cargo names (%d) reached.\nIgnoring new name.\n", MAX_CARGO); + MessageBox(str, "Error", MB_ICONEXCLAMATION); + } } MODIFY(Ships[ship].cargo1, (char)z); |
2010-03-19 02:48
|
fix_2132_v3.diff (779 bytes)
Index: code/fred2/shipeditordlg.cpp =================================================================== --- code/fred2/shipeditordlg.cpp (revision 6012) +++ code/fred2/shipeditordlg.cpp (working copy) @@ -1253,9 +1253,16 @@ if (strlen(m_cargo1)) { z = string_lookup(m_cargo1, Cargo_names, Num_cargo); if (z == -1) { - Assert(Num_cargo < MAX_CARGO); - z = Num_cargo++; - strcpy(Cargo_names[z], m_cargo1); + if (Num_cargo < MAX_CARGO) { + z = Num_cargo++; + strcpy(Cargo_names[z], m_cargo1); + } + else { + str.Format("Maximum number of cargo names (%d) reached.\nIgnoring new name.\n", MAX_CARGO); + MessageBox(str, "Error", MB_ICONEXCLAMATION); + z = 0; + m_cargo1 = Cargo_names[z]; + } } MODIFY(Ships[ship].cargo1, (char)z); |
|
Removed the log as it's not needed. |
|
Fix applied and credited to Genghis. |
Date Modified | Username | Field | Change |
---|---|---|---|
2010-02-17 14:49 | Evergreen | New Issue | |
2010-02-17 14:49 | Evergreen | File Added: Cargo_Crashbug_Example.fs2 | |
2010-02-17 14:52 | Evergreen | Note Added: 0011691 | |
2010-03-17 03:11 | Genghis | File Added: fix_2132.diff | |
2010-03-17 03:14 | Genghis | Note Added: 0011786 | |
2010-03-17 13:34 | Genghis | File Added: fix_2132_v2.diff | |
2010-03-19 02:48 | Genghis | File Added: fix_2132_v3.diff | |
2010-03-19 02:59 | Goober5000 | Note Added: 0011792 | |
2010-03-19 02:59 | Goober5000 | Additional Information Updated | |
2010-03-19 06:47 | Goober5000 | Note Added: 0011794 | |
2010-03-19 06:47 | Goober5000 | Assigned To | => Genghis |
2010-03-19 06:47 | Goober5000 | Status | new => resolved |
2010-03-19 06:47 | Goober5000 | Resolution | open => fixed |
2010-03-19 06:47 | Goober5000 | Fixed in Version | => 3.6.12 RC2 |