Skip to content

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
DrunkOnJava merged 1 commit into
mainfrom
fix/crafted-file-overflow-panics
Nov 12, 2026

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

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:

  • an element's creation episode at u32::MAX;
  • two wall shell-layer counts whose sum passes the address limit.

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 + 1 cannot wrap to 0 on a 32-bit target and index episodes[len].
    • decode_increment_rows: greatest_episode + 1 is a checked add, and i64::MAX is refused as an invalid range.
  • src/research/native_walls.rs, shell_widths: exterior + interior is a checked add. On a 32-bit target a wrapped sum passed the length check, and widths[..exterior] sliced past the end.
  • src/research/native_stairs.rs, native_stair_counts and railing_records: the riser count top - base is a checked subtraction, and the run is skipped where it overflows, as it is where top <= 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 in u64.
  • changelog.d/security/1831-file-value-overflows.md.

Testing

  • Unfiltered Measure against main on 5f3c030b (samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): 43304867952. Every export and diagnostics hash should be equal to main'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 it

  • Real files: the unfiltered Measure

  • Hardening: the i686 overflow-checks job builds the changed code

Audit-honesty checklist

  • No claim beyond what ships; no repro, stated
  • Security changelog fragment
  • No emojis or private paths

Legal and contribution hygiene

  • Apache-2.0; no Autodesk source

Breaking changes

None. Every changed function is private or keeps its signature.

https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge

…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
DrunkOnJava marked this pull request as ready for review November 12, 2026 22:01
@DrunkOnJava
DrunkOnJava enabled auto-merge (squash) November 12, 2026 22:47
@DrunkOnJava
DrunkOnJava merged commit de13257 into main Nov 12, 2026
65 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/crafted-file-overflow-panics branch November 12, 2026 22:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crafted files: seven overflows in arithmetic on file values panic a reader, two of them in the 32-bit viewer build

1 participant