dev_status: guard nullptr in Builds::name() #2313

Open
github-bot wants to merge 1 commit from github-bot/gh-2313 into main AGit
Owner

@⁠narekshaghoyandev on GitHub · 2026-11-26 13:45 UTC · original
narekshaghoyandev:ubiq-dev-status-null-name → main · +42 −0 · 2 files · 1 commits · open

Fixes a null-pointer dereference in leonida::dev_status::Builds::name(const char* text) (runtime/src/dev_status.h):

  • Previously, passing nullptr to Builds::name() (or constructing Build(nullptr)) called std::strlen(nullptr), causing immediate UB/SIGSEGV.
  • Guard if (!text) by clearing name_[0] = 0 and returning early.
  • Added standalone unit test 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.cpp passed
  • g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/dev_status_test.cpp passed
  • Negative control: new test failed with UBSan null-argument + ASan SEGV against unmodified ubiq/main
  • python3 -I scripts/check_no_game_data.py runtime/src/dev_status.h runtime/test/dev_status_test.cpp clean

Claimed in the coordination issue as: RT-DEV-STATUS-NULL-NAME (#1608)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-26 13:45 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2313) `narekshaghoyandev:ubiq-dev-status-null-name` → `main` · +42 −0 · 2 files · 1 commits · open Fixes a null-pointer dereference in `leonida::dev_status::Builds::name(const char* text)` (`runtime/src/dev_status.h`): - Previously, passing `nullptr` to `Builds::name()` (or constructing `Build(nullptr)`) called `std::strlen(nullptr)`, causing immediate UB/SIGSEGV. - Guard `if (!text)` by clearing `name_[0] = 0` and returning early. - Added standalone unit test `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.cpp` passed - `g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic -Iruntime/src runtime/test/dev_status_test.cpp` passed - Negative control: new test failed with UBSan null-argument + ASan SEGV against unmodified `ubiq/main` - `python3 -I scripts/check_no_game_data.py runtime/src/dev_status.h runtime/test/dev_status_test.cpp` clean Claimed in the coordination issue as: RT-DEV-STATUS-NULL-NAME (https://git.gtahub.st/github/ubiquitarianism--leonida/issues/1608) AI-assisted: yes (Gemini)
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 13:50:01 +00:00
This pull request can be merged automatically.
This branch is out-of-date with the base branch
You are not authorized to merge this pull request.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin '+refs/pull/2313/head:github-bot/gh-2313'
git switch 'github-bot/gh-2313'

Merge

Merge the changes and update on Forgejo.
git switch 'main'
git merge --no-ff 'github-bot/gh-2313'
git switch 'github-bot/gh-2313'
git rebase 'main'
git switch 'main'
git merge --ff-only 'github-bot/gh-2313'
git switch 'github-bot/gh-2313'
git rebase 'main'
git switch 'main'
git merge --no-ff 'github-bot/gh-2313'
git switch 'main'
git merge --squash 'github-bot/gh-2313'
git switch 'main'
git merge --ff-only 'github-bot/gh-2313'
git switch 'main'
git merge 'github-bot/gh-2313'
git push origin 'main'
This discussion has been locked. Commenting is limited to contributors.
No description provided.