Repository navigation
fix(research): arithmetic on a stored creation episode, shell-layer count, riser index, episode id, circuit count or stream length is checked, so a crafted file cannot overflow it (#1831) - #1832
Merged
Conversation
…ount, riser index, episode id, circuit count or stream length is checked, so a crafted file cannot overflow it (#1831) Seven sums and products on values read from the file are checked and refuse a value that overflows. Two of them panicked the 32-bit and wasm32 builds without overflow checks: an element's creation episode at u32::MAX (native_index::parse) and two wall shell-layer counts (shell_widths). The other five overflowed where overflow checks are on. No real file changes. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
DrunkOnJava
marked this pull request as ready for review
November 12, 2026 22:01
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Seven sums and products on values read from the file are now checked, and a value that overflows is refused. Two of them panicked the 32-bit and wasm32 builds the viewer runs, which have no overflow checks:
u32::MAX;The other five overflowed where overflow checks are on (debug builds, CI's i686 job). No real file should change; the Measure run checks that.
Motivation
Closes #1831. Tendrils audit workers found these, a second worker confirmed each, and I re-read each against
main.Changes
src/research/native_index.rs:parse:len - (creation_episode + 1)is two checked subtractions, so the+ 1cannot wrap to 0 on a 32-bit target and indexepisodes[len].decode_increment_rows:greatest_episode + 1is a checked add, andi64::MAXis refused as an invalid range.src/research/native_walls.rs,shell_widths:exterior + interioris a checked add. On a 32-bit target a wrapped sum passed the length check, andwidths[..exterior]sliced past the end.src/research/native_stairs.rs,native_stair_countsandrailing_records: the riser counttop - baseis a checked subtraction, and the run is skipped where it overflows, as it is wheretop <= base. A release build used to wrap to -1 risers.src/research/partition_mep_systems.rs,circuit_number: the add after the checked multiply is checked too.src/transmission_data.rs,looks_like_utf16_le: the ratio is taken inu64.changelog.d/security/1831-file-value-overflows.md.Testing
Unfiltered Measure against
mainon5f3c030b(samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): 43304867952. Every export and diagnostics hash should be equal tomain's.No repro. Each site needs a crafted schema and object graph to reach it through the public reader, which is out of proportion to a one-line checked operation. Each was verified by reading; Crafted files: seven overflows in arithmetic on file values panic a reader, two of them in the 32-bit viewer build #1831 says so.
tools/check-local.sh: not run locally (no local builds); CI runs itReal files: the unfiltered Measure
Hardening: the i686 overflow-checks job builds the changed code
Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None. Every changed function is private or keeps its signature.
https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge