mirror of
https://github.com/ubiquitarianism/leonida.git
synced 2026-11-26 22:00:52 +01:00
[PR #486] [MERGED] SHADER-LIBRARY-BOUNDS-KEYS: guard zlib limit sums and reject malformed f16_halves keys #536
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#536
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/486
Author: @xroneyaa
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @QemmHD
Base:
main← Head:fix/shader-library-bounds-and-keys📝 Commits (1)
60905feshader_library: guard zlib limit sums and reject malformed f16_halves keys📊 Changes
2 files changed (+25 additions, -7 deletions)
View changed files
📝
runtime/src/shader_library.h(+17 -6)📝
runtime/test/shader_library_test.cpp(+8 -1)📄 Description
Claimed in the coordination issue as: SHADER-LIBRARY-BOUNDS-KEYS
What and why
runtime/src/shader_library.h,detail::inflate_codesandzlib_inflatecheckedout.size() + length > limitandat + 4 > in.size(), which can overflowstd::size_twhenlimitis nearSIZE_MAX. Replaced these checks with overflow-free subtraction (out.size() > limit || length > limit - out.size(), andat > in.size() || in.size() - at < 4).ShaderLibrary::load_file()parsedf16_halvesJSON keys withstd::strtoul(key.c_str(), &end, 10), which accepted leading whitespace,+/-signs (e.g."-1"wrapping to0xFFFFFFFF), and truncated overflowing values like"4294967296"touint32_t(0)(overwriting parameter0). Replaced this with strict ASCII unsigned decimal parsing bounded toUINT32_MAX.Added
SIZE_MAXinflate tests and malformed/overflowingf16_halveskey rejection tests inruntime/test/shader_library_test.cpp.Tested
shader_library_testanddstorage_testwith MSVC 19.50 / Ninja (0 warnings in touched files)ctest --test-dir runtime/build -R "^(shader_library|dstorage)$" --output-on-failure-> 2/2 Passed (shader_library0.02 s,dstorage0.51 s)python -I scripts/check_no_game_data.py runtime/src/shader_library.h runtime/test/shader_library_test.cpp-> exit 0GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed (n/a — no translator rule added).🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.