reprend #2016: runtime: guard null and invalid sizes in value_write_sink and add unit tests (RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS) #2735

Manually merged
github merged 3 commits from github-bot/gh-2735 into gh-pr/2735/base 2026-11-30 17:18:38 +00:00 AGit
Owner

@⁠OreoFR on GitHub · 2026-11-30 13:39 UTC · original
OreoFR:carry/pr-2016 → main · +237 −1 · 3 files · 3 commits · merged 2026-11-30 17:15 UTC

Carries #2016 by @⁠abnalstlll-byte, because it conflicts with main after #2566 and the reminder to merge main (#2016) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped.

Item: RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS-CARRY (claimed in #2570; original item RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS).

What this branch is

  • The author's branch at 804f97479, unchanged (no rebase, author commits kept).
  • A merge of main (from the carry preparation of 29/11) that resolves the conflict, then a merge of current main f9f3ec4c6, which had a new conflict (below). Both merge commits carry Co-authored-by the author.
  • Nothing else: the change itself is the original PR's; see #2016 for what and why, and the verifications posted there.

What conflicted and how it was resolved

  • runtime/CMakeLists.txt: the PR's value_write_sink_test after main's console_heap_slot_records and shadow_keep tests.
  • New with f9f3ec4c6: runtime/CMakeLists.txt: main added the title_frames, title_mirror_hooks and title_heap tests at the same place; all kept, the PR's test after them.

Tests

  • On this branch (main f9f3ec4c6 merged), Windows 11, Python 3.12, no GPU used: C++ only: left to this PR's CI (no local C++ build in this run).
  • Earlier merge: ctest 502 tests, value_write_sink passes; red: the test does not compile on main (reset_for_test absent); big_compile_gate timed out on the loaded PC, to check on the runners.
  • python -I scripts/check_no_game_data.py on every file this PR changes: clean.
  • CI on this PR covers the rest (C++ build and ctest, the full translator suite).

Depends on: none.

Needs an independent verifier before merge (red/green on another machine), as for any carry.

AI-assisted (Claude Code, oreofr-agent).

🤖 Generated with Claude Code

**@⁠OreoFR** on GitHub · 2026-11-30 13:39 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2735) `OreoFR:carry/pr-2016` → `main` · +237 −1 · 3 files · 3 commits · merged 2026-11-30 17:15 UTC Carries #2016 by @⁠abnalstlll-byte, because it conflicts with `main` after #2566 and the reminder to merge `main` (https://git.gtahub.st/github/ubiquitarianism--leonida/pulls/2016) got no answer within the delay of the carry rule. If the author comes back, this carry is dropped. Item: `RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS-CARRY` (claimed in https://git.gtahub.st/github/ubiquitarianism--leonida/issues/2570; original item `RT-VALUE-WRITE-SINK-GUARDS-AND-TESTS`). ### What this branch is - The author's branch at `804f97479`, unchanged (no rebase, author commits kept). - A merge of `main` (from the carry preparation of 29/11) that resolves the conflict, then a merge of current `main` `f9f3ec4c6`, which had a new conflict (below). Both merge commits carry `Co-authored-by` the author. - Nothing else: the change itself is the original PR's; see #2016 for what and why, and the verifications posted there. ### What conflicted and how it was resolved - `runtime/CMakeLists.txt`: the PR's `value_write_sink_test` after `main`'s `console_heap_slot_records` and `shadow_keep` tests. - New with `f9f3ec4c6`: `runtime/CMakeLists.txt`: `main` added the `title_frames`, `title_mirror_hooks` and `title_heap` tests at the same place; all kept, the PR's test after them. ### Tests - On this branch (`main` `f9f3ec4c6` merged), Windows 11, Python 3.12, no GPU used: C++ only: left to this PR's CI (no local C++ build in this run). - Earlier merge: `ctest` 502 tests, `value_write_sink` passes; red: the test does not compile on `main` (`reset_for_test` absent); `big_compile_gate` timed out on the loaded PC, to check on the runners. - `python -I scripts/check_no_game_data.py` on every file this PR changes: clean. - CI on this PR covers the rest (C++ build and `ctest`, the full translator suite). Depends on: none. **Needs an independent verifier before merge** (red/green on another machine), as for any carry. AI-assisted (Claude Code, oreofr-agent). 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Harden runtime/src/value_write_sink.h:
- Guard arena() against null buffer pointers and non-4/8-byte sizes by immediately returning Landing::refused, preventing null dereference and invalid writes.
- Guard title_pages() against null addresses, null bytes, and zero size by returning false immediately.
- Guard clear_arena() to reject null device pointers.
- Add clear_title_pages() and reset_for_test() to allow clean state resets across tests and teardown.
- Add portable CPU-only CTest unit test runtime/test/value_write_sink_test.cpp verifying initial state, guards, arena and title_pages dispatch, device-matched clearing, and multi-threaded concurrency.

AI-assisted (Claude Code)
CMakeLists: value_write_sink_test (PR) after main's console_heap_slot_records and shadow_keep tests (main renamed console_heap_vsharp_slots).

Co-authored-by: abnalstlll-byte <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Current main after #2566. New conflict on top of the earlier carry merge:
runtime/CMakeLists.txt: main added the title_frames, title_mirror_hooks and
title_heap tests at the place of the PR's value_write_sink test; all kept,
the PR's test after main's.

Co-authored-by: abnalstlll-byte <[email protected]>
Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-30 13:40:46 +00:00
Author
Owner

@⁠Kal0s-design on GitHub · 2026-11-30 14:13 UTC · original

Independent Windows check of 30857b8b7 on current main b17b22d33 (no conflict, tree 2adaba89f). Native Windows 11, MSVC 19.50 x64. test/value_write_sink_test.cpp was built alone as its CMake target builds it, under AddressSanitizer with the debug CRT and checked iterators (/W4 /permissive- /utf-8 /Od /MDd /fsanitize=address).

  • Green: OK: value_write_sink_test passed all checks, no ASan report, 0 warnings, including the test's threads.
  • Red isn't possible as a run: this PR's test needs the hooks it adds to value_write_sink.h (reset_for_test, clear_title_pages), so against main's header it doesn't compile (C3861 on each).

I didn't read the conflict resolution line by line.

GPUs tested: n/a (CPU unit test). AI-assisted: yes.

**@⁠Kal0s-design** on GitHub · 2026-11-30 14:13 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2735#issuecomment-7281034732) **Independent Windows check** of `30857b8b7` on current `main` `b17b22d33` (no conflict, tree `2adaba89f`). Native Windows 11, MSVC 19.50 x64. `test/value_write_sink_test.cpp` was built alone as its CMake target builds it, under AddressSanitizer with the debug CRT and checked iterators (`/W4 /permissive- /utf-8 /Od /MDd /fsanitize=address`). - Green: `OK: value_write_sink_test passed all checks`, no ASan report, 0 warnings, including the test's threads. - Red isn't possible as a run: this PR's test needs the hooks it adds to `value_write_sink.h` (`reset_for_test`, `clear_title_pages`), so against `main`'s header it doesn't compile (C3861 on each). I didn't read the conflict resolution line by line. GPUs tested: n/a (CPU unit test). AI-assisted: yes.
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-30 15:43 UTC · original

Verified by MoonEyes (another owner than OreoFR) on head 30857b8b7 merged with main be7690805: Windows 11, MSVC 2022 x64, RelWithDebInfo, ctest -R ^value_write_sink$: 1/1 passed. No red: the test uses hooks this pull request adds to value_write_sink.h (C3861 without it). CPU unit test, no run of the title.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-11-30 15:43 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2735#issuecomment-7283487383) Verified by MoonEyes (another owner than OreoFR) on head `30857b8b7` merged with `main` `be7690805`: Windows 11, MSVC 2022 x64, RelWithDebInfo, `ctest -R ^value_write_sink$`: 1/1 passed. No red: the test uses hooks this pull request adds to `value_write_sink.h` (C3861 without it). CPU unit test, no run of the title. AI-assisted (Claude Code).
github-bot changed target branch from main to gh-pr/2735/base 2026-11-30 17:18:29 +00:00
github manually merged commit 30857b8b72 into gh-pr/2735/base 2026-11-30 17:18:30 +00:00
Author
Owner

@⁠MoonEyes on GitHub · 2026-11-30 17:15 UTC · original

Merging. Head 30857b8b7 merges cleanly with main 149e3835f and does not force a rebase of #2566. Unit test green on Windows 11 by two other people; no red possible (the test needs the new hooks). Merged by MoonEyes.

AI-assisted (Claude Code).

**@⁠MoonEyes** on GitHub · 2026-11-30 17:15 UTC · [original](https://github.com/ProjectLeonida/mandy/pull/2735#issuecomment-7285966754) Merging. Head `30857b8b7` merges cleanly with `main` `149e3835f` and does not force a rebase of #2566. Unit test green on Windows 11 by two other people; no red possible (the test needs the new hooks). Merged by MoonEyes. AI-assisted (Claude Code).
This discussion has been locked. Commenting is limited to contributors.
No reviewers
No milestone
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
github/ubiquitarianism--leonida!2735
No description provided.