mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-27 00:25:52 +01:00
[PR #1429] bvh_geometry_check: catch NaN leaf bounds, infinite-bound override tolerance blow-up, invalid --geom, and strict JSON (BVH-GEOMETRY-CHECK-NAN-INF-GEOM) #1459
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#1459
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/1429
Author: @IlyassRS3
Created: 11/25/2026
Status: 🔄 Open
Base:
main← Head:fix/bvh-geometry-check-nan-inf-geom📝 Commits (1)
e5f7426bvh_geometry_check: catch NaN leaf bounds, infinite-bound override tolerance blow-up, invalid --geom, and strict JSON (BVH-GEOMETRY-CHECK-NAN-INF-GEOM)📊 Changes
2 files changed (+129 additions, -7 deletions)
View changed files
📝
tests/test_bvh_geometry_check.py(+94 -0)📝
tools/bvh_geometry_check.py(+35 -7)📄 Description
Item ID:
BVH-GEOMETRY-CHECK-NAN-INF-GEOMAI-assisted: yes
Summary
Fixes four soundness and input-validation bugs in
tools/bvh_geometry_check.py:NaN/±inf) leaf and scene bounds silently passedcheck_bounds():NaNbounds,max([box[a] - b[a], ...]) > OUTSIDE_TOLERANCE * extentevaluated toFalse, and Python'smin(union[a], NaN)/max(union[a + 3], NaN)droppedNaNonce another finite leaf populatedunion— falsely reportingleaves_outside=0, bounds_gap=0.0, consistent=True.check_bounds()now rejects non-finite mappedsceneBoundscorners and counts any leaf with non-finite bounds as outside (settingbounds_gap = math.inf,consistent = False).check_overrides()tolerance blew up to+infon infinite child bounds:if math.isfinite(value)without checkingmath.isfinite(b[comp]). When a child bound was±inf(e.g. a BOX16 bound overflowing half-float range) and the stored overridevaluewas finite,tolbecame+inf, turninglo - tol <= value <= hi + tolinto-inf <= value <= +infand accepting overrides wildly outside[lo, hi]._ulp_tol(value, ref)so each bound comparison (b[comp],lo,hi) applies ULP tolerance only when both operands are finite.--geom VB[,IB]validation and early--jsondirectory check:--geomspecs (len(parts) > 2or empty VB path such as--geom vb,ib,extra,--geom ,ib,--geom "") with exit status 2 instead of silently dropping extra tokens or opening"".--json <existing_dir>before reading/rehydrating.--jsonoutput (allow_nan=False):bounds_gap = infon inconsistent non-finite inputs) are serialized as JSONnullwithallow_nan=Falserather than emitting non-standardNaN/Infinitytokens.Verification (macOS Apple M5, arm64, Python 3.14; no game files)
python3 -m compileall -q make_game.py tools tests— OKpython3 -I scripts/check_no_game_data.py tools/bvh_geometry_check.py tests/test_bvh_geometry_check.py— OKpython3 -I tests/test_bvh_geometry_check.py -v— 12/12 OK (5 new regression tests)tests/test_bvh_*.pysuites — 214/214 OKpython3 -I tests/test_text_write_line_endings.py— 3/3 OKpython3 -I tests/test_ci_registration.py— 16/16 OKtests/test_bvh_geometry_check.pyagainst unpatchedupstream/main1154976d4):Ran 12 tests — FAILED (failures=5)— all 5 new regression tests fail without this fix.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.