Skip to content

zipio: CRC fallback accepts a file longer than the first load chunk - #4

Open
sevdestruct wants to merge 1 commit into
carmiker:masterfrom
sevdestruct:crc-fallback-multichunk
Open

sevdestruct wants to merge 1 commit into
carmiker:masterfrom
sevdestruct:crc-fallback-multichunk

Conversation

@sevdestruct

@sevdestruct sevdestruct commented Sep 21, 2026 •

Copy link
Copy Markdown

The by-CRC pass in nc_zipset_read required m_uncomp_size == expect_len, but expect_len is the first load's length. A program ROM loaded as LOAD + CONTINUE (e.g. mslug 201-p1, 2 MB as two 1 MB chunks) is longer than that, so a renamed-but-identical member could never match by CRC — the name pass fails on .bin vs .p1, then the size check fails on the CRC pass, and the set is reported as missing ROM: 201-p1.p1 (crc 08d8daa5) even though 201-p1.bin with that exact CRC is in the zip.

Changing the comparison to >= fixes it. Measured on a MAME 0.139-era set: before, 3 of 6 sets refused (mslug, samsho2, viewpoin); after, 6/6 convert and the .neo output is byte-identical (sha256) to converting the same games from a modern-named set.

Sorry for the earlier close-and-withdraw on this one — housekeeping on my side, nothing to do with the patch.

nc_zipset_read's second pass matched by CRC only when the member's size
equalled expect_len. expect_len is the FIRST load's length, so a file
loaded as LOAD + CONTINUE (mslug 201-p1: 2 MB in two 1 MB chunks) could
never match by CRC. A MAME 0.139-era set whose 201-p1.bin is byte-identical
to 201-p1.p1 was refused as 'missing ROM' by name, then by size.

With >=, mslug, samsho2 and viewpoin from a 0.139 dump convert; the output
is byte-identical to a conversion from a modern-named set (sha256, 6/6).
@sevdestruct
sevdestruct deleted the crc-fallback-multichunk branch September 21, 2026 04:47
@sevdestruct sevdestruct changed the title zipio: CRC fallback accepts a file longer than the first load chunk closed Sep 21, 2026
@sevdestruct
sevdestruct restored the crc-fallback-multichunk branch September 21, 2026 05:56
@sevdestruct sevdestruct changed the title closed zipio: CRC fallback accepts a file longer than the first load chunk Sep 21, 2026
@sevdestruct sevdestruct reopened this Sep 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant