Repository navigation
Conversation
…eject unknown types
|
Tested
AI-assisted. No game files. |
|
Tested efe94cc on NVIDIA GeForce RTX 5080 Laptop GPU, driver 621.14, Windows 11 (build 26300), MSVC 14.44, RelWithDebInfo: pass. |
Kam471
left a comment
There was a problem hiding this comment.
Head efe94cc7842e · Verdict: LGTM
Built xdxr_descs_test; xdxr_descs_test.exe → exit 0 (xdxr_descs: ok). git diff --check clean.
The walk now uses size_in_bytes / sizeof(StreamRecord), so a partial leading/trailing record is never read; type > 2 is rejected before the walk; a huge size cannot wrap pointer arithmetic. Cases cover all of those. No blockers.
|
Tested
AI-assisted (Claude Code). |
Summary
Fixes three bounds and validation defects in
leonida::xdxr::find_stream_record()(runtime/src/xdxr_descs.h):Previously computed
end = (const uint8_t*)desc.stream + desc.size_in_bytesand walkedrecord < end. Any non-multiple ofsizeof(StreamRecord)(e.g.1..15or17..31bytes) inspected and returned aStreamRecord*whose 16 bytes extended pastdesc.size_in_bytes.size_in_bytes:Adding a huge
size_in_bytes(such as~uint64_t{0}) todesc.streamwrapped around the 64-bit address space soend < record, causing UB and returningnullptreven whenrecords[0]matched.type > 2) returned as matches:Checking
record->type == typebeforerecord->type > 2returned an unknown record when queryingtype > 2instead of stopping at unknown types (perdocs/xdxr.md§3).Fix (
efe94cc7)if (type > 2 || desc.stream == nullptr) return nullptr;.const uint64_t count = desc.size_in_bytes / sizeof(StreamRecord);complete 16-byte records by index without computing an out-of-bounds end pointer, checkingif (records[i].type > 2) return nullptr;first.runtime/src/xdxr_descs.h, staying disjoint from open PR XDXR: serialize acceleration structures and record batched builds (RT-148) #4494.Verification (Windows 11 x64, MSVC 19.52 VS2026 Build Tools, Windows SDK d3d12.h)
runtime/test/xdxr_descs_test.cpp):line 77: find_stream_record(StreamDesc{rem, records}, 0) == nullptr(exit 1).efe94cc7):cmake --build runtime/build --target xdxr_descs_test— 0 errors, 0 warnings.runtime\build\xdxr_descs_test.exe->xdxr_descs: ok (checked against d3d12.h)(exit 0).ctest --test-dir runtime/build --output-on-failure -R "^xdxr_descs$"->1/1 Test #6: xdxr_descs ... Passed.python -I -B tests/test_ctest_registration.py(4/4 OK),scripts/check_no_game_data.py(exit 0),git diff --check(exit 0),CRLF=0,git merge-tree --write-tree upstream/main HEAD(bc292b0093888b746e0ee7a891fba7c849efc422, exit 0).AI-assisted (Gemini, Antigravity); no copyrighted game files or dumps used.