Skip to content

Compute the Prototype1b record size from the next offset, not the next header - #1311

Open
ilCosmico wants to merge 1 commit into
DomCR:masterfrom
ilCosmico:fix/prototype1b-header-order
Open

ilCosmico wants to merge 1 commit into
DomCR:masterfrom
ilCosmico:fix/prototype1b-header-order

Conversation

@ilCosmico

Copy link
Copy Markdown
Contributor

DwgPrototype1bReader.readDataFields takes the size limit of a record from the header that follows it in the list, but the headers are not always stored in the order of their records. In a 2013 DWG saved by DWG TrueView the local offsets were 10982, 0, 5491, 11026: for the first record the subtraction wraps around, the blob marker 0xBB106BB1 passes the inline check and ReadBytes throws an OverflowException. As with #1305, the exception stops the whole section and no ModelerGeometry in the drawing gets its AcisData.

The limit now comes from the closest larger offset among all the headers, or from the end of the segment when there is none. The order of the headers doesn't change. The obsolete reader sorted the headers by offset before the same calculation, which is why it could read these files.

With the fix the payloads match the ones from the obsolete DataStorage reader on that drawing and on the other 2013+ DWG files with solids I have, and the test suite passes.

This branch has not been deployed

No deployments
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