runtime: guard null and invalid sizes in value_write_sink and add unit tests (RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS) #2016
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2016"
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?
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-25T18:12:19Z.
Claimed in the coordination issue as: RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7170514927)
What and why
Harden
runtime/src/value_write_sink.hand provide unit test coverage:arena()against null buffer pointers and non-4/8-byte sizes by immediately returningLanding::refused, preventing null dereference and invalid writes.title_pages()against null addresses, null bytes, and zero size by returningfalseimmediately.clear_arena()against null device pointers (!device).clear_title_pages()andreset_for_test()to allow clean state resets across tests and teardown.runtime/test/value_write_sink_test.cppverifying initial state, guards, arena and title_pages dispatch, device-matched clearing, and multi-threaded concurrency.Tested
g++ -std=c++20 -Wall -Wextra runtime/test/value_write_sink_test.cpp-> builds cleanly, runs and exits 0 (OK: value_write_sink_test passed all checks).python -I tests/test_ci_registration.py->Ran 16 tests in 4.676s,OK.python -I tests/test_text_write_line_endings.py->Ran 3 tests in 11.795s,OK.python -I scripts/check_no_game_data.py runtime/src/value_write_sink.h runtime/test/value_write_sink_test.cpp runtime/CMakeLists.txt->exit 0.git diff --check->clean.Tested on Windows 11 x64 (GCC C++20 / Python 3.12, stdlib tests, no game data needed).
AI-assisted (Claude Code)
Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T02:48:45Z.
Hi @abnalstlll-byte, thanks for this pull request. It currently conflicts with
main(conflicting file(s):runtime/CMakeLists.txt), so it carries theneeds rebaselabel. CONTRIBUTING.md asks authors to rebase their branch onmain; once it merges cleanly the label goes within the hour, and reviews start with the pull requests that do. Could you update the branch when you have a moment? If you no longer plan to continue with it, please say so here.AI-assisted (Claude Code, Claude Opus 5.5).
Imported from ubiquitarianism/leonida. Originally posted by OreoFR on 2026-11-30T13:40:32Z.
Carried as #2735 because of the conflict with main after #2566; @abnalstlll-byte, if you come back, say so and the carry is dropped.