mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:50:52 +01:00
[PR #1574] rbf0_encode: fail closed on malformed descriptors/nodes/lengths/float overflow and harden CLI (RBF0-ENCODE-FAIL-CLOSED-VALIDATION) #1594
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#1594
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/1574
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/rbf0-encode-fail-closed-validation📝 Commits (1)
e8baf7frbf0_encode: fail closed on malformed descriptors/nodes/lengths/float overflow and harden CLI📊 Changes
2 files changed (+136 additions, -28 deletions)
View changed files
📝
tests/test_rbf0_encode.py(+78 -0)📝
tools/rbf0_encode.py(+58 -28)📄 Description
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)).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.