bvh_rehydrate: validate leaf order, box child count, --geom spec, and saturate f32 overflow (BVH-REHYDRATE-INPUT-VALIDATION) #1393
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!1393
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/bvh-rehydrate-input-validation"
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
Item ID:
BVH-REHYDRATE-INPUT-VALIDATIONSummary
Fixes four malformed-input / overflow crashes in
tools/bvh_rehydrate.py(whose CLI contract is exit status 0 on success and 2 on input errors):write_leaves): rejects invalid low-nibble(a, b)pairs wherea == 3,b == 3, ora == b(all 10 non-permutations of{0, 1, 2}) withValueErrorinstead of crashing with uncaughtIndexErroronSLOT_OF_ORDER[which]orTypeErrorwhen unpackingNoneslots.write_box_groups): rejects box nodes declaringkids > 4withValueErrorinstead of unpacking extra child words and failing later insidestruct.pack_into.f32): catchesOverflowErrorand returnsmath.copysign(math.inf, x)(matchingfloat_to_halfand GPU float32 arithmetic) so large scales inLeafFrame.applyor transforms inGeometry.vertexdo not terminatemain()with an uncaughtOverflowError, whileparse_transformcontinues rejecting non-finite transform entries withValueError.--geomvalidation (main): rejects malformed--geomvalues with extra commas (VB,IB,extra) or an empty vertex-buffer path (,IB) withValueError(exit 2) instead of silently ignoring trailing fields.Tests & Verification
python3 -m compileall -q make_game.py tools tests— OKpython3 -I scripts/check_no_game_data.py tools/bvh_rehydrate.py tests/test_bvh_rehydrate.py— OKpython3 -I tests/test_bvh_rehydrate.py -v— 22/22 OKpython3 -I tests/test_bvh_rehydrate_stage_cleanup.py -v— 1/1 OKpython3 -I tests/test_bvh_packing_check.py— 31/31 OKpython3 -I tests/test_bvh_geometry_check.py— 7/7 OKpython3 -I tests/test_bvh_slot_check.py— 9/9 OKpython3 -I tests/test_bvh_match.py— 42/42 OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OKtests/test_bvh_rehydrate.pyagainst unpatchedupstream/main): 2 failures, 14 errors.Red/green: On main test_bvh_rehydrate.py has 2 failures and 14 errors (leaf order, --geom spec and f32 overflow not validated), and with the PR all 22 tests pass on Windows 11 at OreoFR's (RTX 4070).
Independent tester (OreoFR, RTX 4070, Windows 11): PR head merged with the other PRs of its batch on main c1ecf04ed, full ctest run (485 tests, tests that launch the game excluded): no new failure compared with main.
Verified by OreoFR
3408969a7+ PR head23205312bpython -I tests/test_bvh_rehydrate.pyAI-assisted (Claude Code, Claude Opus 5.5).