Source Code Project Mantis - FSSCP
View Issue Details
0003050FSSCPFREDpublic2014-05-29 18:112014-09-24 02:37
ReporterAxem 
Assigned ToCommanderDJ 
PrioritynormalSeveritycrashReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version3.7.2 RC2 
Target Version3.7.2Fixed in Version3.7.2 
Summary0003050: Custom mainhall text is limited to 10 chars in the campaign editor
DescriptionDespite the actual game allowing long main hall text names, the FRED campaign editor will throw a fit if the name is over 10 characters long.

In campaign_editor::mission_selected(), mainhalltext is an array of 10 characters, but the actual main hall names are stored as SCP_Strings which I think can be quite a bit more than 10 characters.
Steps To ReproduceMake a new campaign
Set the mainhall name to something long like 12345678900
Get this error when you click on the mission again

---------------------------
Microsoft Visual C++ Debug Library
---------------------------
Debug Error!

Program: C:\Games\FreeSpace\fred2_open_3_7_2_RC2-DEBUG.exe
Module: C:\Games\FreeSpace\fred2_open_3_7_2_RC2-DEBUG.exe
File:

Run-Time Check Failure 0000002 - Stack around the variable 'mainhalltext' was corrupted.

(Press Retry to debug the application)
---------------------------
Abort Retry Ignore
---------------------------
TagsNo tags attached.
Attached Filespatch 3050.patch (884) 2014-06-09 18:10
http://scp.indiegames.us/mantis/file_download.php?file_id=2385&type=bug

Notes
(0015826)
CommanderDJ   
2014-06-09 05:40   
Should be an easy fix - I evidently missed this when doing the mainhall stuff all the way back in 2012.

Is a patch enough for you to test with, or would you like a build?
(0015828)
CommanderDJ   
2014-06-09 08:20   
Patch updated, credit to niffiwan for the suggestion.
(0015831)
niffiwan   
2014-06-09 17:20   
Er - just noticed that the assignment seems to be the wrong way around?
  Campaign.missions[num].main_hall = mainhalltext;
should be this?
  mainhalltext = Campaign.missions[num].main_hall;

Or maybe get rid of the temp SCP_string entirely and just have this?

bc_hall->SetWindowText(Campaign.missions[num].main_hall.c_str());
(0015832)
CommanderDJ   
2014-06-09 18:11   
Whoops - you're right, patch updated. Also, upon further testing it seems that there is a different limit somewhere else in the code of 31 characters - so we can get names higher than 10 with the current patch but not more than 31. I'll look into this further.
(0016292)
Goober5000   
2014-09-24 02:36   
The 31-character limit is beyond the scope of this bug. The patch looks fine, and that's sufficient for now I think.

Issue History
2014-05-29 18:11AxemNew Issue
2014-06-09 05:39CommanderDJAssigned To => CommanderDJ
2014-06-09 05:39CommanderDJStatusnew => assigned
2014-06-09 05:39CommanderDJFile Added: 3050.patch
2014-06-09 05:40CommanderDJNote Added: 0015826
2014-06-09 08:18CommanderDJFile Deleted: 3050.patch
2014-06-09 08:18CommanderDJFile Added: 3050.patch
2014-06-09 08:20CommanderDJNote Added: 0015828
2014-06-09 08:20CommanderDJStatusassigned => code review
2014-06-09 17:20niffiwanNote Added: 0015831
2014-06-09 18:10CommanderDJFile Deleted: 3050.patch
2014-06-09 18:10CommanderDJFile Added: 3050.patch
2014-06-09 18:11CommanderDJNote Added: 0015832
2014-06-09 18:11CommanderDJStatuscode review => assigned
2014-06-29 19:09Goober5000Target Version => 3.7.2
2014-09-24 02:36Goober5000Note Added: 0016292
2014-09-24 02:36Goober5000Changeset attached => fs2open trunk r11081
2014-09-24 02:37Goober5000Statusassigned => resolved
2014-09-24 02:37Goober5000Resolutionopen => fixed
2014-09-24 02:37Goober5000Fixed in Version => 3.7.2