2019-12-07 16:57 EST


View Issue Details Jump to Notes ]
IDProjectCategoryView StatusLast Update
0002132FSSCPFREDpublic2010-03-19 02:47
ReporterEvergreen 
Assigned ToGenghis 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
Product Version3.6.10 
Target VersionFixed in Version3.6.12 RC2 
Summary0002132: FRED 3.6.10 crashes when cargo list is longer than 30 items
DescriptionA 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 InformationThis 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()
------------------------------------------------------------------
TagsNo tags attached.
Attached Files
  • ? file icon Cargo_Crashbug_Example.fs2 (26,405 bytes) 2010-02-17 09:49
  • diff file icon fix_2132.diff (822 bytes) 2010-03-16 23:11 -
    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);
    
    diff file icon fix_2132.diff (822 bytes) 2010-03-16 23:11 +
  • diff file icon fix_2132_v2.diff (735 bytes) 2010-03-17 09:34 -
    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);
    
    diff file icon fix_2132_v2.diff (735 bytes) 2010-03-17 09:34 +
  • diff file icon fix_2132_v3.diff (779 bytes) 2010-03-18 22:48 -
    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);
    
    diff file icon fix_2132_v3.diff (779 bytes) 2010-03-18 22:48 +

-Relationships
+Relationships

-Notes

~0011691

Evergreen (reporter)

Ah, sorry for the long log, I didn't realize you could upload multiple files.

~0011786

Genghis (developer)

I added a candidate fix, called fix_2132.diff.

~0011792

Goober5000 (administrator)

Removed the log as it's not needed.

~0011794

Goober5000 (administrator)

Fix applied and credited to Genghis.
+Notes

-Issue History
Date Modified Username Field Change
2010-02-17 09:49 Evergreen New Issue
2010-02-17 09:49 Evergreen File Added: Cargo_Crashbug_Example.fs2
2010-02-17 09:52 Evergreen Note Added: 0011691
2010-03-16 23:11 Genghis File Added: fix_2132.diff
2010-03-16 23:14 Genghis Note Added: 0011786
2010-03-17 09:34 Genghis File Added: fix_2132_v2.diff
2010-03-18 22:48 Genghis File Added: fix_2132_v3.diff
2010-03-18 22:59 Goober5000 Note Added: 0011792
2010-03-18 22:59 Goober5000 Additional Information Updated
2010-03-19 02:47 Goober5000 Note Added: 0011794
2010-03-19 02:47 Goober5000 Assigned To => Genghis
2010-03-19 02:47 Goober5000 Status new => resolved
2010-03-19 02:47 Goober5000 Resolution open => fixed
2010-03-19 02:47 Goober5000 Fixed in Version => 3.6.12 RC2
+Issue History