You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Native readers: 32-bit panics on a crafted record length or container count, and two work budgets that do not bound what they should #1815
Four places where a crafted file can make a native reader panic or do unbounded work. Each was found by an audit of the parsing paths and checked line by line against main (314eeace).
A panic on 32-bit targets.src/research/native_document.rs:785-797, group_records: end = start.checked_add(length)? on a u32 length read from the file, then end + 4 unchecked, in the comparison, the slice bytes[end..end + 4] and pos = end + 4. On a 32-bit target, a group whose length field is 0xFFFFFFF5 gives end = 0xFFFFFFFD. With overflow checks (CI's i686 job) end + 4 panics. Without them (wasm32, which the browser viewer runs on) it wraps to 1, and bytes[0xFFFFFFFD..1] panics. On 64-bit the ensure! refuses the group cleanly.
STRIP_BUDGET does not count the work it bounds.src/research/native_parametric_mesh.rs:1127-1130 checks (u_knots.len() - 1) × segments.len() <= STRIP_BUDGET (20,000,000), while the trapezoid loop at :1184-1191 also walks v_knots for each trapezoid, so a hostile trim can ask for about strips × segments × v_knots, some 4e10 comparisons.
The walker's two-column container read multiplies a file's count unchecked.src/walker.rs:2469-2475, read_field, Container { kind: 0x0e }: count is a u32 from the record, checked only against WalkerLimits::max_container_records (default 1,000, a public field), then col_bytes = 4 + count * 6 and total = 2 * col_bytes. A caller that raises the cap (usize::MAX reads as "no cap") gets an overflow panic on i686 for a count of 357,913,941 or more. trial_walk_checked reads the same wire shape with checked_mul and checked_add (:2294-2301).
Done when
(1) and (4) fail closed on every target, with a crafted repro in tests/fuzz_regressions.rs that reaches it through the public reader and fails the i686 overflow-checks job without the fix.
(2) and (3) are bounded, each by a value stated with why, and what a face over it becomes (refused, with which note) is shown on a synthetic input if no real file reaches it.
Every export of a real file is byte for byte as before: one unfiltered Measure (samples, Nordic, Revit 2025, held-out) against main, rows registered here first.
Found by Tendrils audit workers (DeepSeek) and checked by rvtDevelop; the code edits will be read line by line before they are pushed.
changed the title [-]Native readers: a 32-bit panic on a crafted record length, and two work budgets that do not bound what they should[/-][+]Native readers: 32-bit panics on a crafted record length or container count, and two work budgets that do not bound what they should[/+]on Nov 12, 2026
Expected results for af723ef (fix/1815-native-reader-bounds), registered before its Measure run:
Exports unchanged. Every ifc.sha256 and every scorer file equals main's on an unfiltered run: samples, Nordic, Revit 2025, rac_advanced and the held-out models. No real face reaches CYLINDER_RING_POINT_BUDGET (20,000) or CUT_BUDGET (250,000,000), and no real group record reaches the overflow.
native_group_record_length_overflow_does_not_panic passes on every target. On 64-bit its counts read (groups, unframed_groups) == (1, 1), which shows the crafted file reached group_records. Before the fix it panics on the i686 job; that job runs the fix, so the pass there is the evidence.
The two trimmed_cells tests pass in cargo test --profile ci --lib. Without the counting, the hostile face is cut whole and the first test fails.
On (4) of this issue, the walker's container: no crafted file can reach it through the public reader. read_adocument reads ADocument only at an offset where trial_walk_checked matched every field, with checked arithmetic over the same wire shape. A count large enough to overflow a 32-bit usize can't fit the bytes that trial needs, so the trial refuses the offset first. The fix keeps read_field safe on its own if a future caller skips the trial, but there is no repro for it. I'm stating that rather than writing a test that doesn't exercise the path.
Row 3, measured: on scratch branch hotfix/red-1815-i686-repro (f26beccc: main97397b9 plus only the new test, with no fix), the i686 overflow-checks job (run 43294376618, job 131448806688) fails on fuzz_regressions::native_group_record_length_overflow_does_not_panic alone (302 of 303 pass): "panicked at src/research/native_document.rs:791:13: attempt to add with overflow", the unchecked end + 4. With the fix (#1823) the same test passes there. The scratch branch is deleted.
Rows 1 and 2 hold on af723ef. In unfiltered Measure 43293778765, with samples, Nordic, BIMcollab, rac_advanced and the held-out models against main97397b9:
102 of 102 ifc.sha256 equal main's, and the scorer diff holds only the two head-only across-saves files;
all 18 semantic diffs read "no semantic difference";
9a5bf3b adds only a test, a doc comment, a changelog fragment and the dropped dev-dependency line on top, so these rows carry over to it. Row 3 is cited above, and row 4 runs in CI's --lib job.
#1823 lands (1) through (4) in code, but this issue stays open for two parts of its done-when:
(2): the cylinder ring budget is in place and Measure shows no real face reaches it. Its refusal (cylinder trim budget exceeded, the element drawn without its saved mesh) isn't yet shown on a synthetic face. ring_impl needs an object graph, and the tests have no builder for one; the pure ring_points_with count it uses is already tested.
(4): no crafted file can reach it through the public reader (see above). It's fixed as defense in depth, with no repro.
Close this once (2) has its synthetic demonstration, or once (4) is accepted as unreachable.
Activity
[-]Native readers: a 32-bit panic on a crafted record length, and two work budgets that do not bound what they should[/-][+]Native readers: 32-bit panics on a crafted record length or container count, and two work budgets that do not bound what they should[/+]DrunkOnJava commentedon Nov 12, 2026
Expected results for af723ef (
fix/1815-native-reader-bounds), registered before its Measure run:ifc.sha256and every scorer file equalsmain's on an unfiltered run: samples, Nordic, Revit 2025, rac_advanced and the held-out models. No real face reachesCYLINDER_RING_POINT_BUDGET(20,000) orCUT_BUDGET(250,000,000), and no real group record reaches the overflow.native_group_record_length_overflow_does_not_panicpasses on every target. On 64-bit its counts read(groups, unframed_groups) == (1, 1), which shows the crafted file reachedgroup_records. Before the fix it panics on the i686 job; that job runs the fix, so the pass there is the evidence.trimmed_cellstests pass incargo test --profile ci --lib. Without the counting, the hostile face is cut whole and the first test fails.On (4) of this issue, the walker's container: no crafted file can reach it through the public reader.
read_adocumentreads ADocument only at an offset wheretrial_walk_checkedmatched every field, with checked arithmetic over the same wire shape. A count large enough to overflow a 32-bitusizecan't fit the bytes that trial needs, so the trial refuses the offset first. The fix keepsread_fieldsafe on its own if a future caller skips the trial, but there is no repro for it. I'm stating that rather than writing a test that doesn't exercise the path.fix(research): #1815 says a crafted file's effects in the changelog, …
DrunkOnJava commentedon Nov 12, 2026
Row 3, measured: on scratch branch
hotfix/red-1815-i686-repro(f26beccc:main97397b9 plus only the new test, with no fix), the i686 overflow-checks job (run 43294376618, job 131448806688) fails onfuzz_regressions::native_group_record_length_overflow_does_not_panicalone (302 of 303 pass): "panicked at src/research/native_document.rs:791:13: attempt to add with overflow", the uncheckedend + 4. With the fix (#1823) the same test passes there. The scratch branch is deleted.DrunkOnJava commentedon Nov 12, 2026
Rows 1 and 2 hold on af723ef. In unfiltered Measure 43293778765, with samples, Nordic, BIMcollab, rac_advanced and the held-out models against
main97397b9:ifc.sha256equalmain's, and the scorer diff holds only the two head-only across-saves files;9a5bf3b adds only a test, a doc comment, a changelog fragment and the dropped dev-dependency line on top, so these rows carry over to it. Row 3 is cited above, and row 4 runs in CI's
--libjob.DrunkOnJava commentedon Nov 12, 2026
#1823 lands (1) through (4) in code, but this issue stays open for two parts of its done-when:
cylinder trim budget exceeded, the element drawn without its saved mesh) isn't yet shown on a synthetic face.ring_implneeds an object graph, and the tests have no builder for one; the purering_points_withcount it uses is already tested.Close this once (2) has its synthetic demonstration, or once (4) is accepted as unreachable.
fix(research): native readers fail closed on a group record length th…
chore(release): prepare v0.20.0 (#1869)
test(research): a cylinder face whose trim ring passes its point budg…