Repository navigation
fix(sections): refuse an encrypted section in the legacy reader with a typed error - #315
Merged
Merged
Conversation
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. |
DrunkOnJava
force-pushed
the
fix/r2004-encrypted-section
branch
from
October 26, 2026 14:51
d5ca4f1 to
a9a74a8
Compare
DrunkOnJava
enabled auto-merge (squash)
October 26, 2026 14:52
DrunkOnJava
force-pushed
the
fix/r2004-encrypted-section
branch
from
October 26, 2026 15:02
a9a74a8 to
1b93f37
Compare
…a typed error
The R2004-family section map's encryption flag (§4.5: 0 none, 1
encrypted, 2 properties only) was ignored by the legacy reader, so a
password-protected section's ciphertext was decompressed and returned as
if it were the section; the streaming walker already refused it.
section_map::read_section_payload, and so DwgFile::read_section and the
readers built on it, now returns the new Error::SectionEncrypted { name }
for a flag of 1, the same refusal as StreamError::SectionEncrypted; a flag
of 2 marks only the properties (AcDb:FileDepList, AcDb:AppInfo in real
files) and is still read. The R2007 refusal, which was Error::Unsupported,
returns the same variant, and its unit test is adapted to it.
No pinned drawing has the flag set to 1, so the corpus counts do not move.
verify_sections.py repackages the sections of the canonical R2004 fixture
and one real drawing per release band, byte for byte, in a file it builds,
with AcDb:AcDbObjects flagged encrypted (a real drawing's section map has no
literal byte for the flag, so it cannot be forged in place) and a control
without the flag: both readers read the control equal to the drawing and
refuse the flagged copy; the built file's encrypted section is refused by
the legacy reader too.
Refs #205
DrunkOnJava
force-pushed
the
fix/r2004-encrypted-section
branch
from
October 26, 2026 15:18
1b93f37 to
bb20eed
Compare
3 tasks
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
An encrypted R2004-family section (§4.5 flag 1) is refused with a typed error by the legacy reader as well as the streaming walker; R2007's encrypted refusal uses the same variant. Refs #205; Griffin's decision relayed by the integrator.
Spec reference
ODA v5.4.1 §4.5 (encryption flag: 0 none, 1 encrypted, 2 properties only). New
Error::SectionEncrypted { name }, the legacy counterpart ofstreaming::StreamError::SectionEncrypted.section_map::read_section_payloadreturns it for a flag of 1; a flag of 2 (AcDb:FileDepList,AcDb:AppInfoin real files) is still read. R2007's refusal,Error::Unsupporteduntil now, returns the same variant (its unit test is adapted). CHANGELOG.md notes both.Test plan
cargo fmt --all -- --check,cargo clippy --all-targets --all-features -- -D warnings(the build used for the next item).tools/streaming/verify_sections.pyrepackages the sections of the canonical R2004 fixture and one real drawing per release band (line_2004,line_2010,line_2013) byte for byte in a file it builds, withAcDb:AcDbObjectsflagged encrypted (a real drawing's section map has no literal byte for the flag, so it cannot be forged in place) and a control without the flag: the streaming walker and the legacy reader (--legacy,read_section_payload) read the control equal to the drawing and both refuse the flagged copy withSectionEncrypted; the built file's encrypted section is refused by the legacy reader too. All earlier cases pass unchanged.r2007::tests::encrypted_section_is_refused_rather_than_mis_decodednow expectsError::SectionEncryptedinstead ofError::Unsupported, because that is the behaviour this PR specifies.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:
CLEANROOM.md).dwg-rsis Apache-2.0 and must remain compatible.My contribution is based on: