d3d12_title_image_census: guard null entries/resources and use stable_sort #2331
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!2331
Loading…
Reference in a new issue
No description provided.
Delete branch "ubiq-title-image-census-guards"
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
Fixes null-pointer dereferences and non-deterministic tie-breaking in
rt::d3d12::log_title_image_uses()(runtime/shims/d3d12_title_image_census.h):!t) in both passes overtexturesbefore dereferencingt->owned/t->cpu.!t->resourcebefore dereferencingt->resource->desc()for placed entries.std::stable_sortinstead ofstd::sortwhen rankingclasses(copied from an orderedstd::map<Shape, AllocationClass>) so equal-sized shapes break ties deterministically.runtime/test/d3d12_title_image_census_test.cpp.Verification
g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic runtime/test/d3d12_title_image_census_test.cpppassedg++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic runtime/test/d3d12_title_image_census_test.cpppassedubiq/mainpython3 -I scripts/check_no_game_data.py runtime/shims/d3d12_title_image_census.h runtime/test/d3d12_title_image_census_test.cppcleanClaimed in the coordination issue as: RT-TITLE-IMAGE-CENSUS-NULL-GUARDS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194035099)
AI-assisted: yes (Gemini)
VERIFY-2331-D3D12— verified headd11cbcc1f5merged cleanly withmain030d2039eon Windows 11 Pro (build 26200), MSVC19.44(x64,/std:c++20 /W4 /WX /permissive- /utf-8 /EHsc), synthetic registry entries only.Red (
main030d2039e) -> Green (030d2039e+d11cbcc1f5)main:runtime/test/d3d12_title_image_census_test.cppagainstmain'sruntime/shims/d3d12_title_image_census.h-> crashed with0xC0000005(STATUS_ACCESS_VIOLATION) dereferencingt->ownedon the null registry entry (textures.emplace(2, nullptr)).cl.exe /nologo /std:c++20 /W4 /WX /permissive- /utf-8 /EHsc runtime/test/d3d12_title_image_census_test.cpp-> 0 warnings, exit0(d3d12_title_image_census_test: ok, reporting1 slot-70 images sharing slot-133 base 2.0 MiBand1 retired awaiting release 1.0 MiBwithout dereferencing null entries or nullt->resource).AI-assisted.
Verified by OreoFR
c1ecf04ed+ PR headd11cbcc1f; green run in a merge package of 16 PRs, no new ctest failure vs mainstandalone build of d3d12_title_image_census_test.exe (the test is not registered in CMake)AI-assisted (Claude Code, Claude Opus 5.5).
Tested
d11cbcc1fmerged (no commit) withmainaa918e5d9, MSVC 19.52 (Visual Studio 18), Windows 11 10.0.26300.Blocker:
runtime/test/d3d12_title_image_census_test.cppis new but is not registered inruntime/CMakeLists.txt, so neither CI norctestever builds or runs it.ctest -Non the merge lists no such test, andtests/test_ctest_registration.pystill passes, so nothing catches this. Registering it the way the other header-only tests are would fix that:Hand-compiled (
cl /std:c++20 /EHsc /O2):runtime/shims/d3d12_title_image_census.hback tomain: crash, exit0xC0000005.I did not run the ctest tests relinked by the header change: test runs on this machine are paused for memory.
AI-assisted (Claude Code).
Merged. Tested by OreoFR (RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11) on this head: d3d12_title_image_census_test red on main (crash 0xC0000005), green with the PR. Note: the test is not registered in CMake. AI-assisted: yes.