Skip to content

fix(ifc): a wall with more than 512 profile regions to cut keeps them as its openings, so a crafted file cannot make a boolean chain deeper than Clone or Debug survives (#1845) - #1910

Merged
DrunkOnJava merged 2 commits into
mainfrom
fix/1845-body-cut-cap
Nov 13, 2026

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

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 and 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.

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:

  • Row 1 (registered on Crafted files: file values reach the IFC, glTF and SVG unsafely, host and cut chains set recursion depth, and four writer passes are quadratic #1845): the unfiltered Measure (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.
  • 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

  • README / docs reflect the current state after this PR
  • 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
  • Commit messages describe WHAT changed and WHY
  • No emojis in code, docs, or commit messages
  • No private paths, personal email addresses, or internal jargon in committed files
  • N/A: no reverse-engineering finding

Legal and contribution hygiene

  • I agree this work is licensable under Apache-2.0
  • This PR contains no Autodesk proprietary source, decompiled internals, or NDA'd SDK content
  • 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.

… as its openings, so a crafted file cannot make a boolean chain deeper than a library consumer's Clone or Debug survives (#1845)

The derived Debug of a SolidShape breaks at 3,072 levels of chain on a 1 MiB stack and Clone at 4,096 (probe_1845_boolean_chain_depth, Measure 43422082815), and a profile of 4,096 curves can make 4,096 regions. Nothing in the export clones or prints a model; the cap bounds the depth where the chain is built.
@DrunkOnJava
DrunkOnJava marked this pull request as ready for review November 13, 2026 12:45
@DrunkOnJava

Copy link
Copy Markdown
Owner Author

Approved at 742f0a9 by the review bot as a self-approval, under Griffin's answer of 2026-11-12 ("You are allowed to self-approve"): rvtDevelop's session has not read the head sent to it at about 12:45 UTC. I re-read the whole diff (the cap, the single continue it adds to the loop whose existing else { continue; } is the fallback it reuses, the changelog fragment) as if another session had written it. Row 1 and row 2 registered on #1845 hold: 146 of 146 exports and 121 of 121 diagnostics files identical, and the gates check passes.

@DrunkOnJava
DrunkOnJava merged commit 5e23e26 into main Nov 13, 2026
63 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/1845-body-cut-cap branch November 13, 2026 13:11
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).
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: file values reach the IFC, glTF and SVG unsafely, host and cut chains set recursion depth, and four writer passes are quadratic

1 participant