[PR #670] [MERGED] vk_compute_test: VKC_HEAP_FILE refuses an offset of 2^32 and a file past the 4 GiB heap (RT-439) (OLD-9943) #710

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

📋 Pull Request Information

Original PR: https://github.com/ubiquitarianism/leonida/pull/670
Author: @LouisRiverstone
Created: 11/24/2026
Status: ✅ Merged
Merged: 11/24/2026
Merged by: @ubiquitarianism

Base: main ← Head: carry-old-9943


📝 Commits (1)

  • 55b5d73 vk_compute_test: VKC_HEAP_FILE refuses an offset of 2^32 and a file that runs past the 4 GiB heap (RT-439)

📊 Changes

1 file changed (+21 additions, -5 deletions)

View changed files

📝 runtime/test/vk_compute_test.cpp (+21 -5)

📄 Description

Claimed in the coordination issue as: OLD-9943 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7129925439)

Replaces the carried-over draft #210. I'm the original author of old upstream PR 9943.

What and why

RT-439. VKC_HEAP_FILE=<path>[@<offset>] accepted the offset 2^32, which is one byte past the 32-bit heap. It also read the whole file without checking that it fits below 2^32 from that offset. Now the offset must be below 2^32. The file's size is checked on the open file before anything is read, so a file too large for the heap is refused without being loaded into memory (pointed out by shdann on the old PR). An empty or unreadable file is still refused, with the same message as before.

The old branch's final diff, applied on current main (21625bca8) as one commit. It applied cleanly.

Tested

Built vk_compute_test on Linux (GCC, cmake -S runtime, RelWithDebInfo) and ran it with synthetic files:

  • f16.bin@0x100000000 is refused: expected <path>[@<offset>]
  • 16 bytes at 0xFFFFFFF8 is refused: runs past the 4 GiB heap
  • a 5 GiB sparse file at @0 is refused before any read: runs past the 4 GiB heap
  • an empty file and a missing file are both refused: cannot read
  • 16 bytes at 0xFFFFFFF0, which ends exactly at 2^32, passes the check. The run then stops at vkCreateBuffer for the 4 GiB heap on llvmpipe (-2, out of host memory), which is a limit of this machine.

No GPU run.

GPUs tested: n/a

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a: test tool only)

🔄 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/670 **Author:** [@LouisRiverstone](https://github.com/LouisRiverstone) **Created:** 11/24/2026 **Status:** ✅ Merged **Merged:** 11/24/2026 **Merged by:** [@ubiquitarianism](https://github.com/ubiquitarianism) **Base:** `main` ← **Head:** `carry-old-9943` --- ### 📝 Commits (1) - [`55b5d73`](https://github.com/ubiquitarianism/leonida/commit/55b5d737f55a380394a5bd689c5144064e7eaf7d) vk_compute_test: VKC_HEAP_FILE refuses an offset of 2^32 and a file that runs past the 4 GiB heap (RT-439) ### 📊 Changes **1 file changed** (+21 additions, -5 deletions) <details> <summary>View changed files</summary> 📝 `runtime/test/vk_compute_test.cpp` (+21 -5) </details> ### 📄 Description Claimed in the coordination issue as: OLD-9943 (https://github.com/ubiquitarianism/leonida/issues/14#issuecomment-7129925439) Replaces the carried-over draft #210. I'm the original author of old upstream PR 9943. ### What and why RT-439. `VKC_HEAP_FILE=<path>[@<offset>]` accepted the offset 2^32, which is one byte past the 32-bit heap. It also read the whole file without checking that it fits below 2^32 from that offset. Now the offset must be below 2^32. The file's size is checked on the open file before anything is read, so a file too large for the heap is refused without being loaded into memory (pointed out by shdann on the old PR). An empty or unreadable file is still refused, with the same message as before. The old branch's final diff, applied on current `main` (21625bca8) as one commit. It applied cleanly. ### Tested Built `vk_compute_test` on Linux (GCC, `cmake -S runtime`, RelWithDebInfo) and ran it with synthetic files: - `f16.bin@0x100000000` is refused: `expected <path>[@<offset>]` - 16 bytes at `0xFFFFFFF8` is refused: `runs past the 4 GiB heap` - a 5 GiB sparse file at `@0` is refused before any read: `runs past the 4 GiB heap` - an empty file and a missing file are both refused: `cannot read` - 16 bytes at `0xFFFFFFF0`, which ends exactly at 2^32, passes the check. The run then stops at `vkCreateBuffer` for the 4 GiB heap on llvmpipe (`-2`, out of host memory), which is a limit of this machine. No GPU run. GPUs tested: n/a AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a: test tool only) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
4ld0 2026-11-26 20:18:48 +01:00
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#710
No description provided.