mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 23:10:53 +01:00
[PR #928] cached_pso: guard null pointers, reject overlong keys, and add unit test #965
Labels
No labels
bug
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
starred/leonida#965
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
📋 Pull Request Information
Original PR: https://github.com/ubiquitarianism/leonida/pull/928
Author: @narekshaghoyandev
Created: 11/24/2026
Status: 🔄 Open
Base:
main← Head:ubiq-cached-pso-bounds📝 Commits (2)
977721ccached_pso: guard null pointers, reject overlong keys, and add unit test6e551a9cached_pso: use valid empty span in test and drop unreachable null-span check📊 Changes
3 files changed (+135 additions, -1 deletions)
View changed files
📝
runtime/CMakeLists.txt(+5 -0)📝
runtime/src/cached_pso.h(+4 -1)➕
runtime/test/cached_pso_test.cpp(+126 -0)📄 Description
Summary
runtime/src/cached_pso.h:fnv1a(nullptr, size)returns the initial FNV-1a offset basis instead of dereferencing NULL.check()returnsCheck::invalidifblob.data() == nullptr.KeyBuilder::tag(nullptr)encodes the null sentinel (0xffffffffu) instead of callingstd::strlen(nullptr).KeyBuilder::bytes(nullptr, n)treats null buffers as length 0 instead of reading through NULL.key.size() > key_bytes) incheck()asCheck::other_descriptioninstead of silently truncating them to 64 bytes and allowing distinct keys with a shared prefix to collide.runtime/test/cached_pso_test.cpp(no GPU, no game data) and registercached_pso_testinruntime/CMakeLists.txt.Verification
g++ -std=c++20 -Wall -Wextra -Werror -pedantic -fsanitize=address,undefined -O1 -g runtime/test/cached_pso_test.cpp -o /tmp/cached_pso_test && /tmp/cached_pso_test—cached_pso_test: OK.main: crashes withAddressSanitizer: SEGVon null blob span before the patch and passes cleanly after.python3 -I scripts/check_no_game_data.py runtime/src/cached_pso.h runtime/test/cached_pso_test.cpp runtime/CMakeLists.txt— clean.Claimed in the coordination issue as: RT-CACHED-PSO-BOUNDS
AI-assisted: yes (Gemini)
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.