Repository navigation
fix(ifc): a stored number past any model is read as absent where it is decoded, and the header comment cannot be ended by the file's own id, so a crafted file cannot write NaN, infinity or its own STEP into an export (#1845) - #1846
Merged
Merged
Conversation
…s decoded, and the header comment cannot be ended by the file's own id, so a crafted file cannot write NaN, infinity or its own STEP into an export (#1845) Root causes, each fixed where it is: - The walker read a stored float as a Float whatever it held, and the element records' boxes and the native graphs took any finite magnitude, from which a centre or a difference became infinite. le_bytes::physical (finite, within 1e30) now decides at all three decodes; a walker float outside it is kept as its bytes, written back unchanged, and the encoder's vector items now re-emit bytes items as the top level does. - emit_header put string-literal-escaped text in a comment, which a `*/` in the PartAtom id could end. - revit_set_placement summed decoded stair counts unchecked. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…tline is not finite as no geometry, as the IFC writer refuses one (#1845) The IFC's file writer, which rvt-ifc, the viewer and the Python binding all use, already refuses a non-finite number. The glTF and SVG writers had no such check: each now has one at the one place every element passes (the node's matrix, the footprint), whatever upstream made the number. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…ite NaN; the glTF and SVG wrote it (#1845) Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…so every partition scanner and the ArcWall record decode do, not three decoders alone (#1845) rvtReview's read of #1846: physical guarded the walker, the native graphs and the record box, while 56 f64_at calls in 16 scanners and two raw decodes in arc_wall_record bypassed it, so a finite 1e200 in a beam axis could still sum to infinity and fail the export. f64_at and f32_at now return None for a value outside physical, as for one past the buffer's end. Every caller already rejects the candidate on None (44 with `?` on one candidate's read, the rest by continue, filter or `return false`), so only a non-physical value changes the path. ArcWallRecord::decode_standard reads its coordinates through f64_at and refuses the record. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
DrunkOnJava
added a commit
that referenced
this pull request
Nov 12, 2026
…ene graph's host depth, wall-top parts, roof envelope points, mullion grid cells and space containment are bounded (#1845) (#1848) ## Summary This takes #1845's classes 2 and 4: recursion depth a crafted file sets, and work with no cap before the allocation. - **Profile-cut chains:** written and meshed by a loop, not by recursion. That is a change of structure, in the same order, so no output moves. - **Bounds:** the scene graph's host depth and five counts each get one, set far above any real model. Past one, that one step is left undone and the export carries on. No real file should change; the Measure run checks that. ## Motivation Part of #1845 (classes 2 and 4; class 1 is #1846, class 3 #1847). Tendrils audit workers found these, a second worker confirmed each, and I re-read each against `main`. The cut chain's verifiers marked it UNSURE: `SKETCH_MAX_CURVES` caps it near 2,048 levels, and whether that overflows the viewer's stack needs a build. A loop removes the question. ## Changes - **`src/ifc/step_writer.rs`** `emit_solid_shape`, **`src/ifc/body_geometry.rs`** `solid_mesh`: a `BooleanResult` chain is walked down its first operand in a loop. - The writer writes the innermost operand, then each level's second operand and result, outward: the ids and order recursion gave. - The mesher keeps the innermost mesh and appends each union's second operand, innermost first, as recursion did. - **`src/ifc/scene_graph.rs`**: an element more than `MAX_HOST_DEPTH` (16, the bound `step_writer::storey_of` already follows) hosts below its storey hangs from its storey. - Before, a crafted file could chain doors through each other: the tree was built by recursion as deep as the chain, after a walk of the whole chain from every element in it. - Rings are broken as before. - **`src/ifc/export_content/wall_tops.rs`**: - `covered_pieces` stops at `MAX_COVERED_PARTS` (1,024, 32 × `MAX_RISERS`) parts, before `join_pieces`, which is quadratic in them. The check after joining stays `MAX_RISERS`. - `embedded` stops at `4 × MAX_RISERS`, the bound `steps` gives its own pieces, and returns as soon as nothing is left. - **`src/ifc/body_geometry.rs`** `envelope_slab_mesh`: `MAX_ENVELOPE_POINTS` (16 a piece at the piece cap). A sliver split adds points but no piece. - **`src/ifc/mesh_volume.rs`** `partner_ends`: a grid cell holding more than 64 mullion ends is no evidence, and its ends count as continued by none. - **`src/ifc/export_content.rs`** `contain_in_spaces`: each storey's spaces are indexed, where each content scanned the model's. The outline vertices tested are held to `SPACE_CONTAINMENT_BUDGET` (1e9, five times a storey of 1,000 rooms under 10,000 pieces); past it nothing is contained in a space. - **`changelog.d/security/1845-depth-and-caps.md`**. ## Testing - Unfiltered Measure against the merge-base `8421e655` on `62ade122` (samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): [43317002875](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43317002875). - Every export and diagnostics hash should equal the base's. - A bound a real file reaches would move one: the walls' and roofs' bodies, the mullions' areas, the space containment. - Not measured: the scene graph, which the viewer and the tree JSON read. No run hashes it. A real model's host chains are one or two deep. - No repro. Each needs a crafted file of thousands of elements. Each was verified by reading. - [ ] `tools/check-local.sh`: not run locally (no local builds); CI runs it - [x] Real files: the unfiltered Measure ## Audit-honesty checklist - [x] No claim beyond what ships; the scene graph is unmeasured, stated - [x] Security changelog fragment - [x] No emojis or private paths ## Legal and contribution hygiene - [x] Apache-2.0; no Autodesk source ## Breaking changes None. `MAX_ENVELOPE_POINTS` is a new public constant beside `MAX_ENVELOPE_PIECES`. The rest is private. https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
…s and the held-out model's one to their own records (#1845) Measure 43316534384 changed three exports, not none. A NaN width passed run_ends_at's tolerance test, and f64_at now refuses it. Claude-Session: https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge
DrunkOnJava
marked this pull request as ready for review
November 12, 2026 23:36
DrunkOnJava
enabled auto-merge (squash)
November 12, 2026 23:50
This was referenced Nov 13, 2026
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
… as its openings, so a crafted file cannot make a boolean chain deeper than Clone or Debug survives (#1845) (#1910) ## Summary A wall's edited elevation profile cuts its regions in the wall's body as a chain of boolean results, one level per region. This stops at 512: a wall with more keeps its regions as its openings (what a wall whose regions are not all solids already does) and has none cut in its body. ## Motivation The last open item of #1845 (after #1846 to #1848): the chain is written and meshed by a loop, but `SolidShape` is `Debug`, `Clone` and `Serialize` by derive and is dropped by the compiler's glue, each recursing over the chain. Measured on a 1 MiB thread (`probe_1845_boolean_chain_depth`, PR #1908, runs [43420945188](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43420945188) and [43422082815](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43422082815)): `debug` breaks at 3,072 levels, `clone` at 4,096, `drop` and `json` at 65,536; a profile of 4,096 curves can make 4,096 regions. My registered hypothesis (a 4,096-level chain survives all four) was wrong for `clone` and `debug`. Nothing in the export, glTF, scene graph or bindings clones or prints a model, so the hazard is a library consumer's. Rows and the reasoning against a balanced union are on [#1845](#1845 (comment)). ## Changes - `src/ifc/export_content/wall_profile.rs`: `MAX_BODY_CUTS` (512) and the check in `cut_profiles_from_bodies`. - `changelog.d/security/1845-body-cut-cap.md`. ## Testing Unit tests are banned in this repository, and no file or fixture here has a wall with more than 512 regions (`gen-fixture` makes scaffolds), so the changed path is not exercised end to end: - [x] Row 1 (registered on #1845): the unfiltered Measure ([43423122492](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43423122492), `31eb90b6` against `0c58ea68`) reads every export and every diagnostics file byte for byte as the base's: 146 of 146 and 121 of 121. No wall of the corpus has more than 512 cut regions. - [x] Row 2: the `same-project gates` check passes on `31eb90b6` (15 samples held to their earlier saves, and the Areas on 4 saves and on the 2021 save). - [ ] This PR's CI (I cannot build locally, so CI is the first compile of this change). - Not measured, and said so: a wall with more than 512 regions; the cap's effect on one is by reading (the existing `else { continue; }` of the same loop leaves a wall's regions as openings). ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR - [x] A user-visible change has its entry as a fragment under `changelog.d/security/` - N/A: no limitation resolved or introduced beyond the cap stated above - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files - N/A: no reverse-engineering finding ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] No new test fixtures ## Breaking changes None for any file here. A crafted file with more than 512 regions in one wall's profile writes that wall's body uncut, with its openings. ## Related issues Closes #1845 once row 1 holds.
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
…f up to a million boolean cuts on a 1 MiB stack, for the depth #1845 left unmeasured (#1908) ## Summary The probe behind #1910: `probe_1845_boolean_chain_depth` builds a chain of 1,024 to 65,536 boolean cuts by a loop and drops, clones, prints and serialises it on a thread of exactly 1 MiB (the viewer's wasm stack; a native thread stands in for it), in a child process for each so an overflow costs one line of output. No `src/` change, no export moves. ## Motivation #1845 item 2, after #1846 to #1848 wrote and meshed a boolean-cut chain by a loop: `SolidShape` is `Debug`, `Clone` and `Serialize` by derive and is dropped by the compiler's glue, and each recurses over the chain. The issue left open "whether that overflows the viewer's stack needs a build to say". Hypothesis, registered before the first run: a 4,096-level chain survives all four on 1 MiB. Result, which refutes it for two of the four (Measure [43420945188](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43420945188) and, at finer depths, [43422082815](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43422082815)): `drop` and `json` hold to 16,384 levels and break at 65,536; `clone` holds to 3,072 and breaks at 4,096; `debug` holds to 2,048 and breaks at 3,072. A profile of 4,096 curves can make 4,096 regions, one circle each. #1910 caps the regions cut in a wall's body at 512. ## Changes - `probes/examples/probe_1845_boolean_chain_depth.rs`. ## Testing - [x] This PR's CI (clippy over the probes crate is its compile; I cannot build locally): the fast jobs pass. - [x] Measure `-f probe=probe_1845_boolean_chain_depth -f probe_scorer=- -f models=einhoven -f base=none -f scorers=none`: read, posted on #1845 and written into the probe's doc. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR (probe only) - [x] A user-visible change has its entry as a fragment under `changelog.d/`: none, a probe - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] No new test fixtures ## Related issues Refs #1845 (closed by #1910).
DrunkOnJava
added a commit
that referenced
this pull request
Nov 13, 2026
…ts sketch beside the volume of its saved mesh, for the count #1856 asks for (#1909) ## Summary The count #1856 asked for before a body is chosen: `probe_1856_sketch_runs_mesh` exports each file as the reader does, takes every stair run drawn from its sketch (`BodySource` `partition_stair_run_sketch`), reads its saved scene, and prints the run's sketch volume (the `NetVolume` of its `Qto_StairFlightBaseQuantities`) beside the volume its saved mesh encloses (signed tetrahedra), with the mesh's status. No `src/` change, no export moves. ## Motivation #1856: a run its sketch draws never takes its saved mesh, which replaces record boxes only; #1846 made the five `rac_advanced` 2024 stairs' first runs read their own records, so those are drawn from their sketch, 2.55% larger than the saved mesh. Row registered before the run, which holds: on `rac_advanced` 2024 the probe reproduces the five runs of the issue to four digits on both volumes (sketch 8.2973 and 11.8273 ft³, mesh 8.0906 and 11.5327). Result (Measure [43421822007](https://github.com/DrunkOnJava/rvt-rs/actions/runs/43421822007), 102 models; held-out models print nothing to a probe): 240 runs in 27 models are drawn from their sketch and every one has a saved mesh; 84 meshes decode whole, 156 in part. Of the 84, the sketch's volume equals the mesh's on 39, is 1% to 3.2% larger on 45, never smaller. Snowdon's Revit export has no quantity set for its flights, and its own flight bodies differ from both volumes by more than they differ from each other, so which body Revit's export gives is not settled (the issue comment has the detail). The issue stays open for that oracle. ## Changes - `probes/examples/probe_1856_sketch_runs_mesh.rs`. ## Testing - [x] This PR's CI (clippy over the probes crate is its compile; I cannot build locally): the fast jobs pass. - [x] Measure `-f probe=probe_1856_sketch_runs_mesh -f probe_scorer=- -f samples=true -f nordic=true -f r2025=true -f holdout=true -f base=none -f scorers=none`: read and posted on #1856. ## Audit-honesty checklist - [x] README / docs reflect the current state after this PR (probe only) - [x] A user-visible change has its entry as a fragment under `changelog.d/`: none, a probe - [x] Commit messages describe WHAT changed and WHY - [x] No emojis in code, docs, or commit messages - [x] No private paths, personal email addresses, or internal jargon in committed files ## Legal and contribution hygiene - [x] I agree this work is licensable under Apache-2.0 - [x] This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content - [x] No new test fixtures ## Related issues Refs #1856 (stays open for an oracle).
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
This takes the first class on #1845: values from the file that reached an export unsafely. Each is fixed at its root:
write_step_to, which every shipped surface uses) refused the whole file over it, and the glTF and plan SVG wrote it.le_bytes::physicaldecides at every decode of a stored number:le_bytes::f64_atandf32_at, which every partition scanner reads through (56 calls in 16 modules), the walker's floats and the native graphs' numbers (Fv::from_f64). No sum or difference made from those values can then become infinite.*/alone.Three of 145 real exports change (Measure 43316534384). The Revit export confirms the one change it can check:
run_ends_attakes the first offset in a run's data where the StairsRun record's bottom elevation and width are the sketch's within 1e-6 ft. A NaN width passed that test, since every comparison with a NaN is false.NumberOfTreadscame out 14 and its sketch, one riser line short of that, was not drawn, so its saved mesh replaced its record box.f64_atnow refuses the NaN, and each matches its own record at offset 2083: bottom 0, top 6.2336 ft, the sketch's width, 13 risers, both flags set. The run has 12 treads and is drawn from its sketch, as its stair's second run already was.NumberOfTreads, and from missing to equal on itsLengthandNetVolume. Nothing it scores gets worse.AreaBodyRefusalreason moves fromarea_circuit_area_differstopoint_not_read.Motivation
Part of #1845 (class 1; classes 2 to 4 follow in their own PRs). Tendrils audit workers found these, a second worker confirmed each, and I re-read each against
main.Changes
src/le_bytes.rs:MAX_MAGNITUDE(1e30) andphysical;f64_atandf32_atreturnNoneoutside it, as for a value past the buffer's end. Every caller already rejects its candidate onNone: 44 use?on one candidate's read, and the restcontinue, filter orreturn false. No caller reads a NaN or infinity as a sentinel. Before, a NaN passed any tolerance test written as a rejection ((x - y).abs() >= toleranceis false for a NaN), which is the stair change above.f32.src/walker.rs:read_field_by_typereads a float outsidephysicalasBytes, notFloat, at its four float reads. A point is read whole or not at all.Bytesitems verbatim, as the top level already did. Items of unknown kind were alreadyBytesand were dropped on encode, so this also fixes that round trip.src/research/graph_value.rs:Fv::from_f64givesNulloutsidephysical. The native decoder already refuses non-finite doubles; this covers the size.src/research/partition_element_records.rs: a record box corner outsidephysicalrefuses the record, as a non-finite one did (now also refused byf64_at).src/arc_wall_record.rs:decode_standardreads its twelve coordinates throughf64_at, not raw bytes, and refuses the record where one is not physical.src/ifc/step_writer.rs,emit_header:*/in the comment text becomes* /.src/ifc/revit_set_placement.rs: the stair flight count sum is checked.src/ifc/gltf.rs,src/ifc/sheet.rs: the node matrix and the footprint are checked as finite, at the one point each output's elements pass.write_step_to), whichrvt-ifc, the viewer and the Python binding all use, already refuses a non-finite number.changelog.d/security/1845-file-values-reach-output.md, with the stair runs this moves.A list of points where one point is not physical is rejected whole by its readers: every float list is read with
collect::<Option<Vec<f64>>>(), so no polygon loses a vertex. (The lists read withfilter_mapare ElementId lists.)Testing
Unfiltered Measure against the merge-base
b3eaaebbonebc396f1(samples, families, Nordic, Revit 2025, BIMcollab, rac_advanced, held-out): 43316534384, timed, sincef64_atis on every scanner's path.ifc.sha256is equal on 142 of 145 models anddiagnostics.jsonon 118 of 120. The three that differ are explained above.8421e655, reads 235 MiB in run 43317496752 and 250 in run 43324820431.The mechanism: the exports kept by Measure 43325269883 give each changed run's body and properties both ways. A replica of
run_ends_at(Python, over the inflated partitions of the local rac_advanced 2024 file) finds offset 508 for each run with main's float reads, and offset 2083 with this PR's.Measure hashes the IFC and diagnostics, not the glTF or the plan SVG. Their guards change nothing for a finite element, which every real export's elements are, but no run measures them: not measured.
No repro. Each site needs a crafted schema or record to reach it through the public reader. Each was verified by reading.
tools/check-local.sh: not run locally (no local builds); CI runs itReal files: the unfiltered Measure
Audit-honesty checklist
Legal and contribution hygiene
Breaking changes
None.
InstanceFieldkeeps its variants; a float that is not physical now comes asBytes, which every reader already takes as an unknown field.https://claude.ai/code/session_01L1QUmYwb7cHmeCQU8FD2Ge