OLD-7928: analyze_4240_full: guard trailing high-bit words, bound zlib inflation, validate limit, and write JSON atomically #890
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/890"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Imported from ubiquitarianism/leonida. Originally posted by narekshaghoyandev on 2026-11-24T14:58:25Z.
Reopening my original upstream PR #7928 cleanly rebased onto
main:process_archive): Guardspos + 12 <= len(stream_data)before readingtriangles/refsso negative float vertex data in the final 4..11 bytes of a stream cannot crash the archive scan withValueError, and only countsstats["groups"]when the group fits in the stream._inflate_bounded,iter_archive_streams): Replaces unboundedd.decompress(block)with chunked decompression capped atmax_inflate(64 MiBdefault) to prevent OOM on zlib bombs.--limitvalidation (process_archive): Rejectslimit < 1andbooldirectly inprocess_archive.write_json,main): Publishes--jsonviatempfile.mkstemp+file_mode.published_mode+replace_retry.replacewithallow_nan=False, trailing LF, and read-only-safe temp cleanup.Verification
python3 -I tests/test_analyze_4240_full.py -v: 19/19 pass (all 3 new tests fail/error againstmain).python3 -I scripts/check_no_game_data.py tools/analyze_4240_full.py tests/test_analyze_4240_full.py: clean.python3 -m compileall -q tools/analyze_4240_full.py tests/test_analyze_4240_full.py: clean.Claimed in the coordination issue as: OLD-7928 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7135225878)
AI-assisted: yes (Gemini)
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T21:05:44Z.
Reviewed
fdcdb6043: hardening ofanalyze_4240_full(trailing high-bit word guard, 64 MiB inflate bound,limitvalidation, atomic staged--jsonwrite). I ran its test file on the PR tree (19 OK) and copied onto main (all 3 new tests fail there, 16 old pass), the exit-code, line-endings, compileall and no-game-data checks (clean), and a synthetic probe on both trees: stream discovery identical,_inflate_boundedbyte-exact, the walker ValueError crash reproduces only on main. Note: the branch is behind main (test_tool_stdout_encoding.pyfails on the branch namingnative_pso_hashes.py, fixed later on main) - a rebase clears it. No findings. AI-assisted review.Recommendation: Merge
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T13:07:35Z.
Red/green: tests/test_analyze_4240_full.py 3 failed on main, 19 passed with the PR.
Targeted batch of 30 PRs (their tests, the tests importing the changed modules, the docs tests, the translator suite) on main
a997a3c: no new failure, Windows 11 / Python.AI-assisted (Claude Code, Claude Opus 5.5)