Skip to content

Writer's R2004-family file header omits the §4.1 fixed fields real files carry #233

Closed

Description

@DrunkOnJava

Found October 26, 2026 while measuring the §4.1 header for the streaming R2004-family header grammar (#205).

file_writer::assemble_dwg_bytes writes a CRC-valid encrypted 0x6C block but none of §4.1's fixed fields. Measured on every R2004-family file available (nextgis/dwg_samples@ff05d5a line/arc/circle 2004, 2010 and 2013, plus the local R2018 sample_AC1032.dwg) against the four canonical fixtures:

Field (§4.1) Every real file Canonical fixtures
plain 0x28 (long) 0x80 0
decrypted 0x10 0x6C 0
decrypted 0x14 4 0
decrypted 0x24 ("ODA writes 1") 1 0
decrypted 0x44 / 0x48 / 0x4C 0x20 / 0x80 / 0x40 0
0xEC..0x100: "copied from the magic number sequence, starting at 0x100 – 0x14" yes zeros
decrypted CRC-32 valid valid

The legacy reader checks only the file-ID string, so nothing fails today; a strict streaming header that treats these documented constants as layout guards would reject the fixtures, as the strict §3.2 reader did for #214.

Not in scope here: the second header copy at the end of the file (the fixtures write address 0), the plain bytes 0x15–0x17 and 0x2C–0x7F (real files carry non-zero values the spec does not explain), and the LZ77 stream framing recorded on #163.

Acceptance:

  • The writer emits the fields above; the canonical fixtures are regenerated deterministically.
  • Only header bytes change; decoded entities and offsets are unchanged on the canonical corpus.

Activity

  1. added
    type:bug
    area:container
    area:writer
    release:R2004
    release:R2010
    release:R2013
    release:R2018
    priority:P2
    on Oct 26, 2026
  2. added 2 commits that reference this issue on Oct 26, 2026
    fec6786
    b88e7d7
  3. added a commit that references this issue on Oct 26, 2026
    72dc231
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:containerarea:writerpriority:P2release:R2004release:R2010release:R2013release:R2018type:bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions