Skip to content

fix: strip checksum page trailers before inflate (#151) - #160

Merged
DrunkOnJava merged 4 commits into
mainfrom
cursor/finding1-checksum-paged-67f9
Aug 29, 2026
Merged

DrunkOnJava merged 4 commits into
mainfrom
cursor/finding1-checksum-paged-67f9

Conversation

@DrunkOnJava

@DrunkOnJava DrunkOnJava commented Aug 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Independently reproduces Discussion #112 Finding 1 / #151.

Credit: @STE1200 / Steffen's team for the reported finding, page constants, and gzip-trailer oracle approach.

What changed

  • Production inflate paths strip 353-byte trailers from each full 65,249-byte stored page (prepare_stream_for_inflate / inflate_stream_*) before RFC 1951 inflate.
  • Wired through Formats, Global/, Partitions/, reader schema, walker, IFC, elem table, writer decompress, and CLIs.
  • read_stream remains stored-byte accurate (writer identity copies unchanged).
  • Synthetic multipage regression + stream-evidence harness (control vs strip).
  • Dated evidence report: reports/security/DISC-112-finding1-reproduction-2026-08-29.md.

Independent evidence (vs reported)

Oracle Result
Page layout 64896+353 Confirmed
Formats gzip ISIZE trailer Control fail → strip ok
Partitions/46 multi-chunk yield 925→935 chunks, +~0.8 MiB
Reported ~48% Formats class loss Not seen as class-count loss on magnetar samples (395=395); trailer oracle still proves control decode is wrong

Test plan

  • cargo test --lib compression::tests
  • cargo test --lib (848 ok)
  • cargo clippy --all-targets --all-features -- -D warnings
  • stream-evidence on magnetar 2024_Core_Interior.rvt + family sample (artifacts under /opt/cursor/artifacts/)

Closes #151.
Refs Discussion #112.

Out of scope: #152–#156 (follow-on).


Note

High Risk
Changes core decompression for large schema, global, and partition streams—wrong strip logic would break reads project-wide, though path gating, identity read_stream, and synthetic/corpus tests mitigate risk.

Overview
Fixes silent corruption on checksum-paged Revit CFB streams (Discussion #112 / #151) by removing 353-byte trailers from each full 65,249-byte stored page before RFC 1951 inflate.

Production: Adds stream-aware helpers inflate_stream_at, inflate_stream_auto, and inflate_all_chunks_for_stream built on existing prepare_stream_for_inflate / strip_revit_page_checksums, and routes Formats/Latest, Global/*, Partitions/*, schema reader, walker, IFC, ElemTable, writer decompress, and corpus/analyze CLIs through them. read_stream still returns stored bytes unchanged for writer identity.

Evidence & regression: New workspace crate stream-evidence (CLI + examples/stream_evidence.rs) emits control-vs-strip JSON for probes; compression gains multipage synthetic tests and extra strip cases; docs/status and a 2026-08-29 security reproduction report supersede the earlier “do not enable strip” probe note.

Reviewed by Cursor Bugbot for commit d55cdcd. Configure here.

cursoragent and others added 4 commits August 29, 2026 19:31
Add a reusable control-vs-experimental checksum-page evidence library
and CLI under tools/stream_evidence (plus examples/ shim and docs/recon).
Does not change production inflate; experimental stripping lives in the
harness for probes. Credits @STE1200 (Steffen) for Discussion #112 Finding 1.

Co-authored-by: DrunkOnJava <[email protected]>
Independently reproduce Discussion #112 Finding 1 (credit @STE1200 /
Steffen's team): full stored pages are 64,896 payload + 353 trailer.
Wire prepare/inflate_stream_* helpers across read paths so gzip ISIZE
trailers validate and multi-chunk partition yield improves. Keep
read_stream stored-byte accurate for writer identity copies. Add
synthetic multipage regression and dated evidence report.

Co-authored-by: DrunkOnJava <[email protected]>
Route Formats/Global/Partitions (and writer decompress) through
inflate_stream_* so production matches the reproduced page-trailer
layout. Add synthetic multipage regression tests; update status and
the 2026-08-28 probe note. Finding reported by @STE1200 / Steffen's team.

Co-authored-by: DrunkOnJava <[email protected]>
@DrunkOnJava
DrunkOnJava merged commit 8c8b083 into main Aug 29, 2026
19 of 23 checks passed
@DrunkOnJava
DrunkOnJava deleted the cursor/finding1-checksum-paged-67f9 branch August 29, 2026 19:47
cursor Bot pushed a commit that referenced this pull request Aug 29, 2026
Resolve DISC-112 probe report conflict: keep Worker C chunk-oracle
addendum and the #160 path-gated production note. Refresh framing
contract + Worker C report for judge narrow scope (no universal strip).

Co-authored-by: DrunkOnJava <[email protected]>
DrunkOnJava pushed a commit that referenced this pull request Nov 10, 2026
…c solids (#1632)

## Summary

Decode a standalone Revit 2020 family's positive revolution from its
saved
profile, axis and angles, and export an analytic `IfcRevolvedAreaSolid`
through
the normal IFC command. Four fixtures are supported: REV-A, REV-B,
REV-BT
(line profiles, including partial and tilted sweeps) and ARC-A (full
torus),
confirmed by Revit's own IFC. ARC-B and ARC-BT remain research/refusal
fixtures.

## Motivation

Turn the RE-391 findings into bounded decoding and export coverage. The
driven
line/arc reader is shared with extrusions; existing project-instance and
family-extrusion behavior is preserved.

## Changes

- Shared sketch-curve selection and typed revolution decoding, with
unsupported
  or ambiguous records and disconnected profile joins refused.
- Analytic IFC profiles and placement, native ElementId tags and body
diagnostics.
- Discover RevolutionElem ids before decoding sketch graphs, avoiding
unused
sketch decoding and false revolution-budget notes in families without
revolutions.
- Pin the unchanged public fixture package and member hashes in

[`research/family-revolutions-measure.tsv`](https://github.com/BIM4GIB/rvt-rs/blob/9505df6fea25a7542c01e161cdfc1aaded13577f/research/family-revolutions-measure.tsv)
  for the maintainer's separate Measure integration.
- Native-file CLI checks, independent geometry replay, three evidence
reports
  (RE-392–394), capability documentation and one changelog entry.

## Testing and reproduction

Fixture download: [six synthetic Revit 2020
families](https://github.com/BIM4GIB/rvt-rs/releases/download/fixtures-revolutions-2020-v2/family-revolutions-revit2020-v2.zip).
`family-revolutions-revit2020-v2.zip` contains six MIT-licensed
synthetic RFAs,
native references, a hash manifest and `REPRODUCE.md` with pinned
dependencies
and build commands. SHA-256:
`6d68bedd29224158c2783fd66ae3072d7f4d931a68540db68856ee12587912c7`.

Checked source:
[9505df6fea25](BIM4GIB@9505df6).

From this PR's source, after that setup:

```text
python tools/oracle/runner/revolutions/verify_package.py --bin-dir target/ci --fixtures EXTRACTED_PACKAGE --output NEW_RESULTS_DIRECTORY
```

- All four replay stages pass: byte evidence, native references,
compiled
reader/refusal controls and actual analytic IFC export. No Revit is
needed.
- Four supported exports pass schema/EXPRESS, placement, closed topology
and
fixed 0.3048 mm sampled-distance / 0.01% volume limits and are
byte-identical
to the previous head. ARC-B and ARC-BT export no body and record an
explicit
  partial-arc refusal.
- Required local gates pass, including 302 integration checks with both
fixture
  folders configured, 27 doc tests and 15 MCP checks.
- Supplementary regression: 23 existing files / 46 default and
`--family-extrusions` exports are byte-identical. Those sample models
are not
  dependencies of the six-fixture replay.
- Hosted CI and the required full Measure/witness comparison remain
pending;
  no witness verdicts have been refreshed. Performance benchmark: N/A.

## Scope and known limitations

One visible positive revolution, one closed convex profile clear of the
axis,
in a standalone 2020 family. Project instances, combined forms, voids,
mixed
line/arc profiles and other releases have no new measured coverage.
Mapped-type
quality modes still refuse the unclassified body.

Profiles containing arcs are exported only for a full turn. The captured
native
IFC for ARC-B disagrees and ARC-BT times out, so neither is exported.
Their native
face/projection captures remain research leads, not export confirmation.
Surface checks are sampled, not whole-surface proofs.

## Audit-honesty checklist

- [x] README, status/support matrix, dated evidence and changelog
reflect the
  final behavior and its limits.
- [x] Fixture cleanup was checked by native save/reopen with unchanged
geometry;
  file hashes and byte offsets describe the cleaned archive.
- [x] No private paths, personal emails, installed sample models or
private
  journal/launch orchestration are included.

## Legal and contribution hygiene

- [x] Code is licensable under Apache-2.0; authored fixture data is MIT.
- [x] Sources are synthetic file bytes, existing clean-room readers,
public API
authoring/oracles and IFC specifications. No proprietary implementation,
  decompiled internals, ODA source or NDA material was used.

## Breaking changes

None to stable APIs or CLI. The research API remains behind
`unstable-research`.

## Output sample

From the 9,051-byte ARC-A export; two profile arcs and a full analytic
turn:

```step
#165=IFCINDEXEDPOLYCURVE(#164,(IFCARCINDEX((1,2,3)),IFCARCINDEX((3,4,1))),.F.);
#163=IFCARBITRARYCLOSEDPROFILEDEF(.AREA.,$,#165);
#166=IFCREVOLVEDAREASOLID(#163,#157,#160,6.283185307179586);
```

## Related issues

Refs #156 and Discussion #393; follows RE-391 / PR #1628. Credit
STE1200's team
for the sketch-to-solid approach described in Discussion #112.
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.

RE: Reproduce checksum-paged stream decompression and silent corruption

2 participants