mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:50:51 +01:00
[PR #1460] anim_index: fix RBF0 string/rig bounds, scan_rpf limit checks, and atomic --rigs/output publishing (ANIM-INDEX-HARDENING) #1491
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#1491
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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 Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/1460
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/anim-index-hardening📝 Commits (1)
84a383eanim_index: fix RBF0 string/rig bounds, scan_rpf limit checks, and atomic --rigs/output publishing📊 Changes
2 files changed (+163 additions, -20 deletions)
View changed files
📝
tests/test_anim_index.py(+81 -0)📝
tools/anim_index.py(+82 -20)📄 Description
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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.