mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 21:50:52 +01:00
[PR #1393] bvh_rehydrate: validate leaf order, box child count, --geom spec, and saturate f32 overflow (BVH-REHYDRATE-INPUT-VALIDATION) #1423
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#1423
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/1393
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/bvh-rehydrate-input-validation📝 Commits (1)
2320531bvh_rehydrate: validate leaf order, box child count, --geom spec, and saturate f32 overflow📊 Changes
2 files changed (+94 additions, -1 deletions)
View changed files
📝
tests/test_bvh_rehydrate.py(+84 -0)📝
tools/bvh_rehydrate.py(+10 -1)📄 Description
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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.