zipio: CRC fallback accepts a file longer than the first load chunk - #4
Open
sevdestruct wants to merge 1 commit into
Open
sevdestruct wants to merge 1 commit into
sevdestruct wants to merge 1 commit into
Conversation
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).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The by-CRC pass in
nc_zipset_readrequiredm_uncomp_size == expect_len, butexpect_lenis the first load's length. A program ROM loaded asLOAD+CONTINUE(e.g.mslug201-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.binvs.p1, then the size check fails on the CRC pass, and the set is reported asmissing ROM: 201-p1.p1 (crc 08d8daa5)even though201-p1.binwith 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.neooutput 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.