anim_index: fix RBF0 string/rig bounds, scan_rpf limit checks, and atomic --rigs/output publishing (ANIM-INDEX-HARDENING) #1460
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!1460
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/anim-index-hardening"
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?
Pull request successfully merged and closed
Claimed in the coordination issue as: ANIM-INDEX-HARDENING
Summary
Hardens
tools/anim_index.pyacross RBF0 parsing, archive scan API validation, error handling, and atomic output publishing:_fd_stringrejection: unlike_u16_string(),_fd_string()did not checklen(raw) != n, silently accepting truncated prefixes past the end ofdata.parse_rbf0()rig pairing: previously, an orphan source tag with no rig before the next source or next rigset stole the following entry's/rigset's rig viabisect_left(rig_offsets, source_at). Now capsendatmin(next_source, next_rigset)and skips sources withrig_at >= end.scan_rpf()validation:limit=0previously treatedif limit:as unbounded andlimit < 0silently scanned 0 bytes; booleans forstart/limitwere also accepted. Now validatesstartandlimit >= 1(non-boolint).--rigsbefore writingout+ atomic staged publishing:main()wrotea.outbefore collecting/parsing--rigs, clobbering an existing index output even when--rigsfailed with exit code 2 (no RBF0 streamorparse_rbf0error).--rigsis now collected and parsed first (withOSError/zlib.errorcaught cleanly).write_output()(JSON and CSV) and--rigsnow publish atomically via_write_text_atomic()(tempfile.NamedTemporaryFilesibling +file_mode.published_mode+os.replace+chmod(0o600)cleanup), rejecting trailing directory separators and symlink loops (ELOOP).OSErrorwhen listing an unreadablea.sourcedirectory during the pre-flight overwrite guard instead of raising an uncaughtPermissionErrortraceback.Testing
arm64), Python 3.14 (CPU-only, synthetic RPF9/RBF0 fixtures only, no game data)python3 -m compileall -q make_game.py tools tests-> cleanpython3 -I scripts/check_no_game_data.py tools/anim_index.py tests/test_anim_index.py-> cleanpython3 -I tests/test_anim_index.py -v-> 53/53 OK (6 new tests)python3 -I tests/test_text_write_line_endings.py-> 3/3 OKpython3 -I tests/test_ci_registration.py-> 16/16 OKtests/test_anim_index.pyon unpatchedupstream/mainb4b7756e8):FAILED (failures=9, errors=1)across all 6 new tests.Red/green: the PR's tests fail on main 4938673 and pass on head 84a383eedd84 (Linux, Python 3.13.18).
Targeted batch of 11 PRs (their tests, the tests importing the changed modules, the docs tests) on main 3ca0707: no new failure, Linux / Python 3.13.
AI-assisted (Claude Code, Claude Opus 5.5)