Repository navigation
fix(writer): emit the §4.3 and §4.6 page checksums real files carry - #266
Merged
Merged
Conversation
Every real R2004-family file checked (both system pages and all 16, 13 and 54 data pages of line_2004, line_2013 and sample_AC1032) carries the §4.2 section page checksum: on a system page, over the compressed data seeded with the checksum of the 0x14-byte header with the field zeroed (§4.3); on a data page, a data checksum over the compressed bytes at 0x1C and a header checksum at 0x18 over the decoded header with that field zeroed, seeded with the data checksum, after a u64 start offset at 0x10 (§4.6). build_system_page wrote 0. build_section wrote a u32 start offset, two rotate-and-add sums (one over the decompressed bytes) at 0x14 and 0x18, and 0x80 at 0x1C. Both now write the spec's checksums at the spec's offsets; compute_checksum's doc no longer claims to be the §4.2 sum. The four R2004-family fixtures are regenerated deterministically; every system and data page checksum in them now verifies under an independent §4.2 implementation, and decoded entities and offsets are unchanged (25/0/0, every handle-map entry resolved). Closes #265
DrunkOnJava
force-pushed
the
fix/writer-page-checksums
branch
from
October 26, 2026 11:02
4d4f4bd to
86dc347
Compare
DrunkOnJava
marked this pull request as ready for review
October 26, 2026 11:02
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
3 tasks done
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
The writer now emits the §4.3 system-page and §4.6 data-page checksums real R2004-family files carry, at the spec's offsets, and the four R2004-family canonical fixtures are regenerated. Closes #265.
Spec reference
ODA Open Design Specification for .dwg files v5.4.1:
crc::section_page_checksum.0x10start offset (OdUInt64),0x18"Page header Checksum (section page checksum calculated from the decoded header bytes, with this field itself zeroed, using the data checksum as seed)",0x1C"Data Checksum (section page checksum calculated from compressed data bytes, with seed 0)".file_writer::build_system_pagewrote 0.section_writer::build_sectionwrote a u32 start offset, two rotate-and-add sums (one over the decompressed bytes) at 0x14 and 0x18, and0x80at 0x1C.compute_checksumstays (benchmarked, public) with its doc corrected.Test plan
line_2004(16),line_2013(13) andsample_AC1032(54) verify; on the old fixtures every one failed; on the regenerated fixtures every system page and all 3 data pages of each fixture verify.cargo run --release --example build_fixtures: deterministic (two runs, identical SHA-256).coverage_report tests/fixtures/canonical: 25 / 0 / 0, every handle-map entry resolved.verify_lz77.pyon the regenerated fixtures;cargo test --release --all-featureswith the 19-file corpus (all suites pass, nothing skipped); fmt; clippy-D warnings.Related and recorded on #265, not changed here:
section_map::DataPageHeaderlabels its fields with the same shifted layout; the reader reads only fields that sit where it expects.Source-provenance declaration
Clean-room declaration. All code in this PR was written from scratch. The only sources consulted were this repository and the ODA's public Open Design Specification for .dwg files v5.4.1. No Autodesk SDK, ODA SDK (Drawings / Teigha), LibreDWG or other copyleft DWG implementation source, and no decompilation, was consulted. Spec citations are in the diff.