Notes |
|
|
Will take a look this week/weekend. |
|
|
|
If you want - but I'm already having a look as well :) |
|
|
(0015175)
|
Echelon9
|
2013-07-08 10:47
(Last edited: 2013-07-08 11:06) |
|
Sacro's is caused by this tripping when ras.name is read as a null from the file, thus causing (ras.ship_class >= csg->ship_list.size()) because ras.ship_class is reading garbage values
Ras.name is read as null because the count variable is ridiculously large, i.e. count = 167772160.
The actual corruption may be introduced even earlier, as the temp value in pilotfile_convert::csg_import() is corrupt before entering pilotfile_convert::csg_import_red_alert()
void pilotfile_convert::csg_import_red_alert()
{
...
int ship_list_size = (int)csg->ship_list.size();
...
for (idx = 0; idx < count; idx++) {
red_alert_ship_status ras;
...
ras.ship_class = cfread_int(cfp);
if (ras.ship_class >= ship_list_size) {
throw "Data failure (RedAlert-ship)!";
}
...
}
}
|
|
|
(0015178)
|
niffiwan
|
2013-07-08 16:57
(Last edited: 2013-07-08 17:15) |
|
Yeah, I suspect that there's something in the 3.6.18 .cs2 not being read correctly by something before this section:
cfread_string(temp, NAME_LENGTH, cfp);
csg->main_hall = temp;
csg_import_red_alert();
and that leaves the cfp file offset in the "wrong place" == bad data reads into temp, count, etc.
I recall that some commits removed various inferno related code, I wonder if the inferno var now isn't being set correctly and thus this .cs2 is being treated like a non-inferno pilot.
Hmmm... well that inferno code wasn't removed, but this looks slightly odd & needs a closer look - is Get_file_list_child reset by cf_get_file_list?
void convert_pilot_files()
...
// get list of old pilots which may need converting, starting with inferno pilots
Get_file_list_child = "inferno";
cf_get_file_list(old_files, CF_TYPE_SINGLE_PLAYERS, "*.pl2");
inf_count = old_files.size();
cf_get_file_list(old_files, CF_TYPE_SINGLE_PLAYERS, "*.pl2");
Yes, it is reset to NULL. Hmmm...
|
|
|
(0015180)
|
niffiwan
|
2013-07-09 05:37
(Last edited: 2013-07-09 05:44) |
|
OK - I think this commit is the problem: r8453
It changes the behaviour of csg_import to treat the mainhall as a string, not as the previous ubyte. Given that the import needs to read data created by 3.6.18 & prior (i.e. before modular mainhalls) I think this small section needs to be reverted. I'll test that now.
csg->main_hall = cfread_ubyte(cfp);
//cfread_string(temp, NAME_LENGTH, cfp);
//csg->main_hall = temp;
And yep - that looks like it :D
|
|
|
|
Patch for one issue is ready - the pilot conversion process needs to use the old way of reading the mainhall ubyte, not the new string. |
|
|
|
Too hasty...
1) need to remove a now unused variable (temp)
2) need to check that the csg->main_hall will handle being assigned a ubyte without side-effects. Worked in my test with Sacro's pilot, but I need to double check to be sure.
Also added CommanderDJ to the monitor list to get his opinion on 2) given that he implemented modular mainhalls |
|
|
|
Apologies for my tardiness. At a glance this looks okay to me, but I'll take a proper look at this in the the next day or two. |
|
|
|
I've had a proper look at this, and I think this should be okay! |
|
|
|
Well, now, wait a minute. In order for both the old main hall code and the new modular main hall code to work, the code has to be able to handle reading both ubytes and strings from that field. N'est-ce pas? |
|
|
|
Well, I'm pretty sure it doesn't.
The old main hall code is <= 3.6.18 only (ubyte / old pilotfile format).
The new mainhall code is >= 3.6.19 only (string / new pilotfile format).
The pilot conversion is the only code that needs to read a ubyte & output a string. The normal pilot reading code in both <= 3.6.18 & >= 3.6.19 just need to deal with their respective / independent formats.
Have I missed something here? |
|
|
|
This was my thinking as well. Assuming the conversion only happens once per pilot and that it only happens on old pilots (someone correct me if these assumptions do not hold), the mainhall field will always be a ubyte during the conversion process. |
|
|
|
Oh, so the conversion code is distinct from the regular pilot code? I thought they overlapped. Separating them does make more sense. |
|
|
|
|
|
|
Hmmm.. I was trying to avoid the auto-close hook :) |
|
|
|
mantis2901b-svn.patch should fix the medals/stats conversion issue. I've successfully tested with three pilots, Sacro + two of mine. Further testing & review would be great. |
|
|
(0015215)
|
z64555
|
2013-08-09 12:40
(Last edited: 2013-08-09 12:41) |
|
With the patches in place, the conversion completes for my pilot as well. I'm getting some parsing errors/warnings later on, though. I was just messing about in the mainhall and the barracks to check the stats.
MVE: Buffer underun (First is normal)
Got event GS_EVENT_GAME_INIT (49) in state NOT A VALID STATE (0)
PLR => Unable to open 'z64555S.plr' for reading!
PLR => Verifying 'Default.plr' with version 1...
PLR => Parsing: Flags..
PLR => (0x0001) Attempted to read 4-byte(s) beyond length limit
CSG => Loading 'z64555.FreeSpace2.csg' with version 2...
CSG => Parsing: Flags...
CSG => Warning: (0x0001) Short read, information may have been lost!
|
|
|
(0015218)
|
niffiwan
|
2013-08-09 22:50
(Last edited: 2013-08-09 22:51) |
|
OK - patch to remove those warnings is attached.
a) mainhall was written to CSG during conversion, but is not written to CSG for normal save/load (which seems a bit odd, but it seems to work OK regardless)
b) cutscenes were written to CSG flags section AND cutscenes section during conversion, but only the cutscenes section for normal save/load
c) the is_multi flag was written for normal PLR save/load but not for the conversion (flag is now used from the previous pilot format)
|
|
|
(0015219)
|
z64555
|
2013-08-10 00:27
(Last edited: 2013-08-10 08:11) |
|
Ok, those fixes worked for me, no longer getting the errors/warnings.
Weakly related, a corrupted .cs2 file creates a nonsensical error message. I've uploaded the files in question as well as the fs2_log. Not sure how much you'll be able to garn from it, though.
Um... I labeled the .zip as 2901d, but it's not the same "d" mentioned in the original ticket. <.<
|
|
|
|
OK - I've had a look at that borked error message and it is not related to 2901, it's related to r9732 & r9739. I'll create a separate mantis for that issue and commit & resolve this one. |
|
|
|
|
Issue History |
|
Date Modified | Username | Field | Change |
---|
2013-07-08 01:11 | niffiwan | New Issue | |
2013-07-08 01:11 | niffiwan | Status | new => assigned |
2013-07-08 01:11 | niffiwan | Assigned To | => niffiwan |
2013-07-08 04:01 | Echelon9 | Note Added: 0015173 | |
2013-07-08 05:12 | niffiwan | Note Added: 0015174 | |
2013-07-08 10:47 | Echelon9 | Note Added: 0015175 | |
2013-07-08 10:57 | Echelon9 | Note Edited: 0015175 | bug_revision_view_page.php?bugnote_id=15175#r576 |
2013-07-08 11:00 | Echelon9 | Note Edited: 0015175 | bug_revision_view_page.php?bugnote_id=15175#r577 |
2013-07-08 11:06 | Echelon9 | Note Edited: 0015175 | bug_revision_view_page.php?bugnote_id=15175#r578 |
2013-07-08 16:57 | niffiwan | Note Added: 0015178 | |
2013-07-08 17:01 | niffiwan | Note Edited: 0015178 | bug_revision_view_page.php?bugnote_id=15178#r580 |
2013-07-08 17:09 | niffiwan | Note Edited: 0015178 | bug_revision_view_page.php?bugnote_id=15178#r581 |
2013-07-08 17:15 | niffiwan | Note Edited: 0015178 | bug_revision_view_page.php?bugnote_id=15178#r582 |
2013-07-09 05:37 | niffiwan | Note Added: 0015180 | |
2013-07-09 05:44 | niffiwan | Note Edited: 0015180 | bug_revision_view_page.php?bugnote_id=15180#r584 |
2013-07-09 05:47 | niffiwan | File Added: mantis2901-svn.patch | |
2013-07-09 05:48 | niffiwan | Note Added: 0015181 | |
2013-07-09 05:48 | niffiwan | Status | assigned => code review |
2013-07-09 21:38 | niffiwan | Note Added: 0015182 | |
2013-07-14 01:38 | CommanderDJ | Note Added: 0015187 | |
2013-07-17 02:37 | CommanderDJ | Note Added: 0015190 | |
2013-07-18 18:45 | Goober5000 | Note Added: 0015194 | |
2013-07-18 19:10 | niffiwan | Note Added: 0015195 | |
2013-07-18 21:15 | CommanderDJ | Note Added: 0015196 | |
2013-07-18 21:37 | Goober5000 | Note Added: 0015197 | |
2013-07-19 22:57 | niffiwan | Additional Information Updated | bug_revision_view_page.php?rev_id=586#r586 |
2013-07-19 22:58 | niffiwan | Relationship added | related to 0002874 |
2013-07-19 23:06 | niffiwan | Changeset attached | => fs2open trunk r9730 |
2013-07-19 23:06 | niffiwan | Note Added: 0015198 | |
2013-07-19 23:06 | niffiwan | Status | code review => resolved |
2013-07-19 23:06 | niffiwan | Resolution | open => fixed |
2013-07-19 23:07 | niffiwan | Note Added: 0015199 | |
2013-07-19 23:07 | niffiwan | Status | resolved => feedback |
2013-07-19 23:07 | niffiwan | Resolution | fixed => reopened |
2013-07-19 23:07 | niffiwan | Status | feedback => assigned |
2013-07-19 23:11 | niffiwan | Description Updated | bug_revision_view_page.php?rev_id=588#r588 |
2013-07-19 23:11 | niffiwan | Additional Information Updated | bug_revision_view_page.php?rev_id=589#r589 |
2013-07-21 18:17 | niffiwan | Additional Information Updated | bug_revision_view_page.php?rev_id=592#r592 |
2013-08-05 04:00 | niffiwan | File Added: mantis2901b-svn.patch | |
2013-08-05 04:13 | niffiwan | Note Added: 0015207 | |
2013-08-05 04:13 | niffiwan | Status | assigned => code review |
2013-08-09 12:40 | z64555 | Note Added: 0015215 | |
2013-08-09 12:41 | z64555 | Note Edited: 0015215 | bug_revision_view_page.php?bugnote_id=15215#r598 |
2013-08-09 22:45 | niffiwan | File Added: mantis2901c-svn.patch | |
2013-08-09 22:50 | niffiwan | Note Added: 0015218 | |
2013-08-09 22:51 | niffiwan | Note Edited: 0015218 | bug_revision_view_page.php?bugnote_id=15218#r600 |
2013-08-10 00:27 | z64555 | Note Added: 0015219 | |
2013-08-10 00:28 | z64555 | File Added: 2901d.zip | |
2013-08-10 08:04 | z64555 | Note Edited: 0015219 | bug_revision_view_page.php?bugnote_id=15219#r602 |
2013-08-10 08:11 | z64555 | Note Edited: 0015219 | bug_revision_view_page.php?bugnote_id=15219#r603 |
2013-08-11 04:22 | niffiwan | Note Added: 0015222 | |
2013-08-11 04:24 | niffiwan | Note Added: 0015225 | |
2013-08-11 04:24 | niffiwan | Status | code review => resolved |
2013-08-11 04:24 | niffiwan | Fixed in Version | => 3.7.0 |
2013-08-11 04:24 | niffiwan | Resolution | reopened => fixed |
2013-08-14 09:50 | Goober5000 | Changeset attached | => fs2open trunk r9745 |