[PR #2307] pipeline_cache_journal: guard null bytes/kind and avoid entry_path truncation #2315

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

📋 Pull Request Information

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

Base: main ← Head: ubiq-pipeline-journal-null-and-kind


📝 Commits (1)

  • 0791348 pipeline_cache_journal: guard null bytes/kind and avoid entry_path truncation

📊 Changes

2 files changed (+16 additions, -2 deletions)

View changed files

📝 runtime/src/pipeline_cache_journal.h (+5 -2)
📝 runtime/test/pipeline_cache_journal_test.cpp (+11 -0)

📄 Description

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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193017383)
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/2307 **Author:** [@narekshaghoyandev](https://github.com/narekshaghoyandev) **Created:** 11/26/2026 **Status:** 🔄 Open **Base:** `main` ← **Head:** `ubiq-pipeline-journal-null-and-kind` --- ### 📝 Commits (1) - [`0791348`](https://github.com/ubiquitarianism/leonida/commit/0791348ed44067bb10691254a5812d1c7fa20cf6) pipeline_cache_journal: guard null bytes/kind and avoid entry_path truncation ### 📊 Changes **2 files changed** (+16 additions, -2 deletions) <details> <summary>View changed files</summary> 📝 `runtime/src/pipeline_cache_journal.h` (+5 -2) 📝 `runtime/test/pipeline_cache_journal_test.cpp` (+11 -0) </details> ### 📄 Description 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://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7193017383) 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#2315
No description provided.