Opened 13 years ago

Closed 13 years ago

Last modified 6 years ago

#9374 closed patch (outdated)

Tools: compress_sci "Pharkas Fixup" incorrect

Reported by: SF/agf863 Owned by:
Priority: normal Component: Tools
Version: Keywords:
Cc: Game:


On line 67 of engines/sci/compress_sci.cpp, if ((memcmp(buffer + 1, "RIFF", 4) == 0) || (memcmp(buffer + 1, "\x8d\x0bSOL", 4) == 0)) { compares the RIFF header correctly but not the SOL header: the given string is 5 characters not 4, and the correct string, "\x8d\x0bSOL\x00" is 6.

The comparison probably still will always give correct results, but the offset will only be correctly adjusted if the header is length 4: for (int i = 0; i < 5; i++) buffer[i] = buffer[i + 1]; _input.read_throwsOnError(&buffer[5], 1);

This patch fixes the comparison and adjustment for SOL files / 6 byte headers. I assume that there aren't actually any SOL resources with the header offset by 1 byte, or else this bug would have been spotted previously, so alternatively the if ((memcmp(buffer + 1, "RIFF", 4) == 0) || (memcmp(buffer + 1, "\x8d\x0bSOL", 4) == 0)) { line could just be reduced to if (memcmp(buffer + 1, "RIFF", 4) == 0) { if checking for an offset RIFF header is adequate.

I'm on the road so I don't have my Freddy Pharkas CD to test this patch right now but it "looks right" and compiles/links.

Ticket imported from: #3324322. Ticket imported from: patches/1479.

Attachments (1)

pharkas_fixup_fix.patch (944 bytes ) - added by SF/agf863 13 years ago.
Patch to correct compress_sci "Pharkas Fixup"

Download all attachments as: .zip

Change History (4)

by SF/agf863, 13 years ago

Attachment: pharkas_fixup_fix.patch added

Patch to correct compress_sci "Pharkas Fixup"

comment:1 by bluegr, 13 years ago

A newer patch for this has been implemented in pull request #2 (which has been merged), thus this patch is obsolete now and can be closed

comment:2 by bluegr, 13 years ago

Resolution: outdated
Status: newclosed

comment:3 by digitall, 6 years ago

Component: Tools
Note: See TracTickets for help on using tickets.