Repository navigation
analyze_4240_full: reject a bad data offset and count --limit honestly - #1670
Merged
ItsNotRexed merged 1 commit intoNov 22, 2026
Merged
ItsNotRexed merged 1 commit into
ItsNotRexed merged 1 commit into
Conversation
A header data offset past EOF made the scan loop skip the whole archive, leaving a zeroed report and exit 0. Raise one ERROR line and keep other inputs running. Also stop --limit N from reporting N+1 streams.
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.
Two silent-wrong-result bugs in
tools/analyze_4240_full.py:iter_archive_streamsaccepts a data offset past EOF.poscomes straight from the header word andwhile pos < sizesimply never runs, so a truncated copy (or the wrong file) printsStreams: 0, writes an all-zero JSON report over the last good one, and exits 0. Reproduced on41f44826with a synthetic 1,933-byte RPF whose offset is0x100000. Sibling readers (rpf9_carve.py,page_index.py) already reject that condition.--limit Nreports N+1 streams.stats["streams"]was incremented before the limit check, so a 5-stream archive with--limit 1reported 2 streams (though it read only 1).Fix
pos > sizewithValueError;main()catches it, prints oneERROR:line naming the archive and offset, sets exit 1 and continues with the other inputs.streamsis exactly the number read.Claimed as a new item in #1548 (comment). Open PR #1615 also touches this file, but only the report
open()line for LF endings — no overlap, noDepends onneeded.Tests
tests/test_analyze_4240_full.py: the bad offset raises and is one ERROR line excluded from the report while the next archive still runs;--limit 1/3/5reports exactly 1/3/5 streams.python -I tests/test_analyze_4240_full.py -v— 9/9 pass.python -m compileall -qon both files andgit diff --check— clean.AI-assisted (OpenCode). No game data in this PR.