pipeline_cache_journal: guard null bytes/kind and avoid entry_path truncation #2307

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

@⁠narekshaghoyandev on GitHub · 2026-11-26 13:35 UTC · original
narekshaghoyandev:ubiq-pipeline-journal-null-and-kind → main · +16 −2 · 2 files · 1 commits · open

Fixes null-pointer dereferences and fixed-buffer truncation in runtime/src/pipeline_cache_journal.h:

  • Guard Hasher::bytes(const void* data, std::size_t size) against data == nullptr (or size == 0) before dereferencing.
  • Build the filename in entry_path() dynamically (std::string + suffix) instead of snprintf into a fixed 64-byte buffer, and default null/empty kind to "entry" so long kind names never truncate the hex key/.bin suffix and null kind never triggers UB.
  • Added regression tests in runtime/test/pipeline_cache_journal_test.cpp covering null Hasher::bytes, null kind, and 60-char kind in entry_path().

Verification

  • g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic passed
  • g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic passed
  • Negative control: new regression test crashed (SIGSEGV, exit 139) against unmodified ubiq/main
  • python3 -I scripts/check_no_game_data.py runtime/src/pipeline_cache_journal.h runtime/test/pipeline_cache_journal_test.cpp clean

Claimed in the coordination issue as: RT-PIPELINE-JOURNAL-NULL-AND-KIND (#1608)
AI-assisted: yes (Gemini)

**@⁠narekshaghoyandev** on GitHub · 2026-11-26 13:35 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2307) `narekshaghoyandev:ubiq-pipeline-journal-null-and-kind` → `main` · +16 −2 · 2 files · 1 commits · open Fixes null-pointer dereferences and fixed-buffer truncation in `runtime/src/pipeline_cache_journal.h`: - Guard `Hasher::bytes(const void* data, std::size_t size)` against `data == nullptr` (or `size == 0`) before dereferencing. - Build the filename in `entry_path()` dynamically (`std::string` + `suffix`) instead of `snprintf` into a fixed 64-byte buffer, and default null/empty `kind` to `"entry"` so long `kind` names never truncate the hex key/`.bin` suffix and null `kind` never triggers UB. - Added regression tests in `runtime/test/pipeline_cache_journal_test.cpp` covering null `Hasher::bytes`, null `kind`, and 60-char `kind` in `entry_path()`. ### Verification - `g++ -std=c++20 -D_GLIBCXX_DEBUG -Wall -Wextra -Werror -pedantic` passed - `g++ -std=c++20 -fsanitize=address,undefined -Wall -Wextra -Werror -pedantic` passed - Negative control: new regression test crashed (SIGSEGV, exit 139) against unmodified `ubiq/main` - `python3 -I scripts/check_no_game_data.py runtime/src/pipeline_cache_journal.h runtime/test/pipeline_cache_journal_test.cpp` clean Claimed in the coordination issue as: RT-PIPELINE-JOURNAL-NULL-AND-KIND (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:38:48 +00:00
Author
Owner

@⁠lixonik on GitHub · 2026-11-26 17:57 UTC · original · reviewed

Windows 11/MSVC: pipeline_cache_journal CTest passed, including the synthetic null-input and long filename cases. No findings from these checks.

AI-assisted.

**@⁠lixonik** on GitHub · 2026-11-26 17:57 UTC · [original](https://github.com/ubiquitarianism/leonida/pull/2307#pullrequestreview-6078689424) · **reviewed** Windows 11/MSVC: `pipeline_cache_journal` CTest passed, including the synthetic null-input and long filename cases. No findings from these checks. AI-assisted.
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/2307/head:github-bot/gh-2307'
git switch 'github-bot/gh-2307'

Merge

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