Skip to content

Validate typed atom kinds and preserve dref entries - #208

Draft
kixelated wants to merge 1 commit into
mainfrom
codex/fix-typed-atom-fourcc-dref
Draft

Validate typed atom kinds and preserve dref entries#208
kixelated wants to merge 1 commit into
mainfrom
codex/fix-typed-atom-fourcc-dref

Conversation

@kixelated

Copy link
Copy Markdown
Owner

Fixes #183

Summary

  • validate typed Decode, ReadFrom, and AsyncReadFrom paths against the atom FourCC before decoding the body
  • replace Dref.urls with ordered Dref.entries supporting url , urn , and opaque unknown entries
  • preserve unknown data-reference payloads and FourCCs during round trips
  • add regression coverage for mismatched typed decoding and mixed dref entries

Root cause

The generic typed convenience implementations decoded T::decode_body without first checking header.kind == T::KIND. Dref also decoded every child directly as Url, so valid urn entries and unknown children could be silently reinterpreted and re-encoded as url .

API impact

Dref { urls: Vec<Url> } becomes Dref { entries: Vec<DrefEntry> }. Existing URL entries can be constructed with Url::default().into().

Validation

  • cargo test --all-features (239 unit tests and 3 doc tests)
  • cargo clippy --all-targets --all-features -- -D warnings
  • cargo fmt --all -- --check
  • git diff --check

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.

Typed decode/read_from never check the FourCC; dref parses any entry as url

1 participant