Skip to content

fix(sections)!: DataPageHeader carries the measured §4.6 layout - #314

Merged
DrunkOnJava merged 1 commit into
mainfrom
fix/data-page-header-labels
Oct 26, 2026
Merged

DrunkOnJava merged 1 commit into
mainfrom
fix/data-page-header-labels

Conversation

@DrunkOnJava

Copy link
Copy Markdown
Owner

Summary

section_map::DataPageHeader carries the layout measured on every data page of the pinned corpus instead of labels that matched none past offset 0x14. Breaking change, recorded in CHANGELOG.md. Refs #205; Griffin's decision relayed by the integrator.

Spec reference

ODA v5.4.1 §4.6 and §4.2. Evidence: cargo run --release --example probe_data_page_header -- --strict reads 580 of 580 data pages of the 28 pinned R2004-family drawings (592 of 592 with the four canonical fixtures) as 0x08 data size, 0x0C page size (the page map's size for the page, not the decompressed size), 0x10 start offset (8 bytes), 0x18 header checksum (§4.2 over the header with its own field zeroed, seeded with the data checksum) and 0x1C data checksum (§4.2 over the stored bytes, seed 0); the former labels agree with 0 of 580 (ARCHITECTURE.md §7n). The Corpus job already runs the probe with --strict.

Test plan

  • Breaking: start_offset: u32 -> u64; page_header_checksum and _unknown removed; header_checksum added; data_checksum now reads 0x1C. read_section_payload takes its LZ77 capacity hint from the section's declared page size (a hint only).
  • cargo fmt --all -- --check, cargo clippy --all-targets --all-features -- -D warnings, RUSTDOCFLAGS="-D warnings" cargo doc --no-deps --all-features, cargo +1.85 check --all-features.
  • Real files: the probe above (--strict, exit 0); tools/streaming/verify_sections.py (its legacy comparison reads every section of 25 real/canonical drawings through read_section_payload, byte-equal to an independent assembly) passes unchanged.
  • No test added or changed; the two examples that used the struct (probe_section_pages, stream_lz77) compile unchanged.

Source-provenance declaration

By submitting this PR I certify that my contribution does not incorporate executable code from any source whose license is incompatible with Apache-2.0. Specifically:

  • No Autodesk DWG SDK source (RealDWG, ObjectARX, ObjectDBX) or NDA-protected Autodesk documentation was consulted or imported.
  • No Open Design Alliance Teigha / Drawings SDK source was consulted or imported. The ODA's public Open Design Specification for .dwg files PDF is explicitly allowed (see CLEANROOM.md).
  • No GPL-licensed DWG implementation source (LibreDWG, etc.) was consulted or imported. This matters because dwg-rs is Apache-2.0 and must remain compatible.

My contribution is based on:

  • The ODA's freely-redistributable Open Design Specification for .dwg files (v5.4.1);
  • Measurement of the pinned public corpus (no algorithm-description comments of other projects were read for this change).

section_map::DataPageHeader labelled its eight words after the §4.6 table,
and from 0x14 on the labels matched no data page of the pinned corpus.
After the Sec_Mask XOR, on all 580 data pages of the 28 pinned R2004-family
drawings and the four canonical fixtures (examples/probe_data_page_header
--strict, which the Corpus job runs): 0x08 data size (the stored bytes
after the header), 0x0C page size (the page map's size for the page, not
the decompressed size), 0x10 start offset (8 bytes), 0x18 header checksum
(§4.2 over the header with its own field zeroed, seeded with the data
checksum) and 0x1C data checksum (§4.2 over the stored bytes, seed 0).

Breaking: start_offset is u64 (was u32); page_header_checksum (0x14, the
high half of the start offset) is gone; header_checksum (0x18) is new;
data_checksum reads 0x1C (it read 0x18); _unknown (0x1C) is gone.
read_section_payload takes its LZ77 capacity hint from the section's
declared page size instead of the page's size on disk; a hint only, the
assembled bytes are unchanged (verify_sections.py's legacy comparison runs
on it). ARCHITECTURE.md §7n, the probe's wording and CHANGELOG.md say so.

Refs #205
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-26T14:32:52.904857Z 4832285 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@DrunkOnJava
DrunkOnJava merged commit 0a9a5b4 into main Oct 26, 2026
25 checks passed
@DrunkOnJava
DrunkOnJava deleted the fix/data-page-header-labels branch October 26, 2026 14:49
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.

1 participant