[PR #2313] dev_status: guard nullptr in Builds::name() #2318

Open
opened 2026-11-26 21:20:49 +01:00 by 4ld0 · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/2313
Author: @narekshaghoyandev
Created: 11/26/2026
Status: 🔄 Open

Base: main ← Head: ubiq-dev-status-null-name


📝 Commits (1)

  • 9ec18b2 dev_status: guard nullptr in Builds::name()

📊 Changes

2 files changed (+42 additions, -0 deletions)

View changed files

📝 runtime/src/dev_status.h (+4 -0)
➕ runtime/test/dev_status_test.cpp (+38 -0)

📄 Description

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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193761192)
AI-assisted: yes (Gemini)


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/ubiquitarianism/leonida/pull/2313 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-dev-status-null-name` --- ### 📝 Commits (1) - [`9ec18b2`](https://github.com/ubiquitarianism/leonida/commit/9ec18b2b872b780fe265724e7ee9448b4d3dca9f) dev_status: guard nullptr in Builds::name() ### 📊 Changes **2 files changed** (+42 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/dev_status.h` (+4 -0) ➕ `runtime/test/dev_status_test.cpp` (+38 -0) </details> ### 📄 Description 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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193761192) AI-assisted: yes (Gemini) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
Sign in to join this conversation.
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
starred/leonida#2318
No description provided.