Repository navigation
xdxr_bvh: validate negative/kind bounds in ptr() and non-finite transforms in invert_affine() - #8788
cristianvaz wants to merge 1 commit into
Conversation
…forms in invert_affine()
Grimkaaah
left a comment
There was a problem hiding this comment.
Independent Linux CPU review (ae576c4d)
What changed: xdxr_bvh validates negative/kind bounds in ptr() and non-finite transforms in invert_affine().
Checked: test_xdxr_bvh_bounds 2 OK.
Looks correct; no game files.
abnalstlll-byte
left a comment
There was a problem hiding this comment.
Verified on Windows 11 (Python 3.14.7).
- Hardens \ ools/xdxr_bvh.py:
- \ptr()\ strictly validates \offset >= 0\ and node kind \
|
Tested ae576c4 on Windows 11 (CPU only, no GPU needed): pass Windows 11 Pro, Python 3.14.7, no GPU or game files involved; pytest/numpy/Pillow pinned from
AI-assisted (Claude Code, Claude Opus 5.5). |
|
Tested
AI-assisted (Claude Code). |
|
Independent check on Windows (no game files). Both guards are correct and the tests fail without them. Run on Windows 11 (10.0.26100), CPython 3.15.0,
The test covers negative offsets, misalignment still rejected, kinds Minor: an overflowing finite determinant is reported as AI-assisted review (OpenCode). |
xdxr_bvh: validate negative/kind bounds in ptr() and non-finite transforms in invert_affine() Independent review: ProjectLeonida#8788 (comment) Fork integration. AI-assisted (Codex).
Claimed in #8683: #8683 (comment)
Summary
Adds missing bounds and finiteness checks to
ptr()andinvert_affine()intools/xdxr_bvh.py:ptr(offset, kind)(tools/xdxr_bvh.py:75-84): Rejects negative offsets (offset < 0) and invalid 3-bit node types (not 0 <= kind <= 7) withValueError, instead of returning negative integers (which later failstruct.pack_into("<I", ...)withstruct.error) or corrupting the pointer's offset bits.invert_affine(m)(tools/xdxr_bvh.py:169-185): Rejects non-finite matrix entries (NaN,+-inf) and non-finite determinants withValueError, instead of silently producingNaNinverse matrices whendet == 0isFalseforNaNorinf.Scope & Conflict Check
ptr()(tools/xdxr_bvh.py:75-84) andinvert_affine()(tools/xdxr_bvh.py:169-185), plus added a dedicated synthetic unit test filetests/test_xdxr_bvh_bounds.py.tools/xdxr_bvh.py(xdxr_bvh: handle D3D12 inactive primitives and NaN bounds #7817, xdxr_bvh: read case JSON with utf-8-sig #6359, xdxr_bvh: add abs_tol for near-origin TLAS check-build hit distances #4833, xdxr_bvh: one unpack per traversal node (trace 2.5x faster, the same hits) #7151, xdxr_bvh: brute_force rounds a scene once, not once per ray (check-build 52 s -> 11 s, the same output) #4626, xdxr_bvh: a check-build folder that does not exist is one ERROR line and exit 2, not the 77 skip (EGEN-XDXR-CHECKBUILD-DIR) #8333, bvh_rehydrate: a finite box bound past the half range keeps 65504, not an infinity #8450).Verification
AI-assisted. Tested on Windows 11, Python 3.12.10 (GPU: AMD Radeon RX 9070, driver
32.0.32029.2010; CPU-only tests, synthetic inputs only, zero game data):python -I tests/test_xdxr_bvh_bounds.pypython -I tests/test_xdxr_bvh.pypython -I tools/xdxr_bvh.py selftestpython -m compileall -q make_game.py tools testspython -I scripts/check_no_game_data.py tools/xdxr_bvh.py tests/test_xdxr_bvh_bounds.py