rbf0_encode: fail closed on malformed descriptors/nodes/lengths/float overflow and harden CLI (RBF0-ENCODE-FAIL-CLOSED-VALIDATION) #1574
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/1574"
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 IlyassRS3 on 2026-11-25T04:49:17Z.
Item ID:
RBF0-ENCODE-FAIL-CLOSED-VALIDATION(new item; coordination issue #14 is at GitHub's 2,500-comment cap with no open successor at PR time — confirmed 0 open PRs touchtools/rbf0_encode.py)Summary
index:_Writer.__init__previously assumeddescriptorswas a list of dicts in positional order and indexedd["index"]directly, crashing withAttributeError/KeyErroron malformed edited reports and mis-mapping out-of-order entries. Now malformed descriptors raiseEncodeError("descriptor", ...), explicit indices map byindex(defaulting to position when omitted), and conflicting duplicate indices are refused.float()overflow insidefloat_bits():float(10**400)previously raised an uncaughtOverflowErrorbefore reachingstruct.pack(), bypassingEncodeError("value", ...)and abortingwrite_all().vec3: requirefloat_special(when present) to be a 3-elementlist(previously non-sequences raisedTypeErrorand 3-char strings like"nan"passedlen == 3).string/text: rejectboolvalues forbyte_length/length(previouslyTrue == 1andFalse == 0slipped past equality checks).element: requireattributesandcontentto be lists of dicts, raisingEncodeError("value", ...)instead ofTypeError/AttributeError.write_all()andmain(): accept UTF-8 BOM reports (utf-8-sig) and catchRecursionError, reject empty/whitespace output directories beforeos.makedirs(), catchOSErrorin--check, and don't format boolean refused offsets (True/False) as hex0x1/0x0.Testing
python3 -W error -I tests/test_rbf0_encode.py -v: 41/41 passedpython3 -W error -I tests/test_text_write_line_endings.py -v: 3/3 passedpython3 -I scripts/check_no_game_data.py tools/rbf0_encode.py tests/test_rbf0_encode.py: passedpython3 -m compileall -q make_game.py tools tests: passedmain:tools/rbf0_encode.py: all 4 new tests fail (FAILED (failures=2, errors=5)).Imported from ubiquitarianism/leonida. Originally posted by copilot-pull-request-reviewer[bot] on 2026-11-25T04:49:33Z.
Review: COMMENTED
Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T10:53:04Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 19 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)