Repository navigation
Description
Found October 26, 2026 while measuring the R2004 system pages for the streaming R2004 walk (#205).
What real files carry (measured on line_2004, line_2013 and the R2018 sample_AC1032.dwg: both system pages and all 16, 13 and 54 data pages verify):
- §4.3 system page (page map, section map): the checksum at 0x10 is the §4.2 section page checksum of the compressed data, seeded with the §4.2 checksum of the 0x14-byte header with that field zeroed.
- §4.6 data page header (after the Sec_Mask):
0x10start offset is a u64,0x18is the header checksum (§4.2 over the decoded header with this field zeroed, seeded with the data checksum),0x1Cis the data checksum (§4.2 over the page's compressed bytes, seed 0).
What the writer does:
file_writer::build_system_pagewrites 0 as the checksum.section_writer::build_sectionwrites a u32 start offset at 0x10, a "page checksum" at 0x14, a "data checksum" at 0x18 and0x80at 0x1C; both checksums usecompute_checksum, a rotate-and-add sum that is not the §4.2 checksum, and the data checksum covers the decompressed bytes.
Every system page and every data page of the four canonical R2004-family fixtures therefore fails §4.2/§4.6. The legacy reader verifies none of these, so nothing fails today; a strict streaming page walk would reject the fixtures.
Related, not in this issue's fix: section_map::DataPageHeader labels its fields with the same shifted layout (start_offset as a u32 at 0x10, page_header_checksum at 0x14, data_checksum at 0x18, _unknown at 0x1C). The reader uses only page_type, data_size and the low half of the start offset, so no decode is affected.
Acceptance:
- The writer emits the §4.3 and §4.6 checksums at the spec's offsets; the canonical fixtures are regenerated deterministically.
- An independent check verifies every system and data page checksum of the regenerated fixtures, as it does on real files.
- Decoded entities and offsets are unchanged on the canonical corpus.
Activity
fix(writer): emit the §4.3 and §4.6 page checksums real files carry