Repository navigation
rows: a trailer whose two sizes wrap past 2^64 is refused, not added unchecked - #2544
Conversation
|
Thanks @chadhurley25075-png, this is a clean fix. The checked sum at Optional, same family of bug, here or in a follow-up: |
…unchecked rows_file.open checked `payload + meta + 96 == end` with plain u64 arithmetic. A trailer whose two sizes add up to the file's size only by wrapping passed it: in a Debug or ReleaseSafe build the addition panics while a store opens, and in the ReleaseFast native binary the file is taken as whole, so readState asks for a `meta`-sized allocation and the whole Rows.open fails with OutOfMemory over one bad file. The sum is now checked, and a pair that wraps is RowsRead like any other trailer that does not match its file. The test writes a block file, adds 2^63 to both sizes in its trailer (their sum is the file's size again, past 2^64) and expects open to refuse it; before this change it panics on the overflow.
bfedfb3 to
dfa24fb
Compare
|
Thank you @chadhurley25075-png. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
|
Thanks @chadhurley25075-png! This is in TensorFold 1.2.6, out now: https://github.com/ashhart/TensorFold/releases/tag/v1.2.6
|
rows_filereads a store file's trailer with its magic, version, kind and name all checked, and its existing test already proves an aborted write leaves no file behind. This adds the one check that trailer was missing, in the same style.What this changes
Before:
rows_file.opencheckedpayload + meta + 96 == endwith plain u64 arithmetic. A trailer whose two sizes add up to the file's size only by wrapping passed it: in a Debug or ReleaseSafe build the addition panics while a store opens, and in the ReleaseFast native binary the file is taken as whole, soreadStateasks for ameta-sized allocation and the wholeRows.openfails with OutOfMemory over one bad file, instead of the documented behaviour of dropping a file that fails its check. After: the sum is checked withstd.math.add, and a pair that wraps isRowsReadlike any other trailer that does not match its file.atc overlap --json(run 2026-11-08 03:2x CT against main):overlaps: [], no open pull request shares the file; one local worktree shares it,conflict: clean.complete: falsewithpullFilesLimit,pullFilesUnavailable,timeLimit, so the open-PR coverage was partial.Checks on this head
python3 tools/zig/lean_check.py, on the base and on this head: 116 and 116, 0 new (python3 tools/pr_check.py --base main: 0 errors, 1 advisory warning about the Unreleased line).zig build -Dfixed-cpu test --test-timeout 10mexit 0 (the runner prints no pass/fail/skip summary on a green build;rows_file.zig's tests are reached throughprompt_cache.rows).zig fmt --check build.zig zigandgit diff --checkclean. Run on this head, bfedfb3, after the rebase onto 1a56448 (test 210 s).test-goldenand the Metal and CUDA device checks; the change is a check at file open and does not reach a kernel or a served token.Receipt
n/a: the change decides which corrupt store file is refused at open; it does not reach inference, tokens or speed.
--learn-conversationsand the prompt cache's disk states).rows_file.openon every platform; host tests on Linux; Metal, CUDA and HIP builds not run.Checklist
zig build -Dfixed-cpu testfails, the Debug test binary crashes on the overflowing addition, Build Summary7558/7626 tests passed (64 skipped, 1 failed, 3 crashed); with the change it passes. No dependency to skip on.)From Chad Hurley and Compass — Compass is our family's assistant; this change was found, fixed and tested on Claude Mythos 5.1.