dev_status: guard nullptr in Builds::name() #2313
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2313"
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?
Imported from ubiquitarianism/leonida. Originally posted by narekshaghoyandev on 2026-11-26T13:45:05Z.
Fixes a null-pointer dereference in
leonida::dev_status::Builds::name(const char* text)(runtime/src/dev_status.h):nullptrtoBuilds::name()(or constructingBuild(nullptr)) calledstd::strlen(nullptr), causing immediate UB/SIGSEGV.if (!text)by clearingname_[0] = 0and returning early.runtime/test/dev_status_test.cpp.Verification
g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/dev_status_test.cpppassedg++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/dev_status_test.cpppassedubiq/mainpython3 -I scripts/check_no_game_data.py runtime/src/dev_status.h runtime/test/dev_status_test.cppcleanClaimed in the coordination issue as: RT-DEV-STATUS-NULL-NAME (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193761192)
AI-assisted: yes (Gemini)
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T12:16:01Z.
VERIFY-2313— verified head9ec18b2b87merged cleanly withmaind48a957bbon Windows 11 Pro (build 26200), MSVC19.44(x64,/std:c++20 /W4 /WX /permissive- /utf-8 /EHsc), synthetic build-status names only.Red (
maind48a957bb) -> Green (d48a957bb+9ec18b2b87)main:runtime/test/dev_status_test.cppagainstmain'sruntime/src/dev_status.h-> crashed with0xC0000005(STATUS_ACCESS_VIOLATION) callingstd::strlen(nullptr)insideBuilds::name(nullptr).cl.exe /nologo /std:c++20 /W4 /WX /permissive- /utf-8 /EHsc /I"runtime/src" runtime/test/dev_status_test.cpp-> 0 warnings, exit0(dev_status_test: ok).AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-28T22:01:58Z.
Verified by OreoFR
c1ecf04ed+ PR head9ec18b2b8; green run in a merge package of 16 PRs, no new ctest failure vs mainstandalone build of dev_status_test.exe (the test is not registered in CMake)AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T22:49:48Z.
Tested
9ec18b2b8merged (no commit) withmainaa918e5d9, MSVC 19.52 (Visual Studio 18), Windows 11 10.0.26300.Blocker:
runtime/test/dev_status_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):dev_status_test: ok, exit 0.runtime/src/dev_status.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).
Imported from ubiquitarianism/leonida. Originally posted by timbot103 on 2026-11-29T04:29:13Z.
Review: COMMENTED
Static audit of head
9ec18b2b8only. No builds, tests, or GPU runs.The guard in
runtime/src/dev_status.h:23clears the buffer while holding the mutex.last()copies the name into an owningstd::stringunder that mutex, andruntime/src/dev_overlay.hcan format the empty result. The guard and standalone test use standard C++ facilities.runtime/test/dev_status_test.cpp:23— The Windows and Linux runtime jobs build the CMake targets and run CTest. This source has no target or CTest entry, and the existingdev_overlaytest only passes non-null names. A future removal of the guard would escape those checks. Please register the test inruntime/CMakeLists.txtor add the two null-input cases toruntime/test/dev_overlay_test.cpp.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-29T14:25:50Z.
Merged. Tested by OreoFR (RTX 4070 Laptop 8 GB, NVIDIA 621.40, Windows 11) on this head: dev_status_test red on main (crash 0xC0000005), green with the PR. Note: the test is not registered in CMake, so ctest does not run it. AI-assisted: yes.