Skip to content

Validate typed atom kinds and preserve dref entries - #208

Merged
bradh merged 2 commits into
mainfrom
codex/fix-typed-atom-fourcc-dref
Oct 30, 2026
Merged

bradh merged 2 commits 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

@kixelated
kixelated force-pushed the codex/fix-typed-atom-fourcc-dref branch from c96c7a0 to 4d5ea3b Compare October 28, 2026 19:42
@kixelated
kixelated marked this pull request as ready for review October 28, 2026 19:42
@kixelated

Copy link
Copy Markdown
Owner Author

Rebased onto main, which now includes the transactional decode_maybe (the FourCC check runs on the peeked header, so a mismatch leaves the buffer untouched), and migrated the newer av1_mdta and mebx fixtures to Dref.entries. cargo test --all-features passes 401 tests, and clippy and fmt are clean. The Dref change is breaking, so this is meant to land before the 0.17.0 release (kixelated/mp4-atom#247).

(Written by Claude Opus 5.5)

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-28T19:43:54.460559Z 4d5ea3b Draft marked ready
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@coderabbitai

coderabbitai Bot commented Oct 28, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 39 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 04e98b8a-3da0-493c-bd09-8076570d97d5
Commits

Reviewing files that changed from the base of the PR and between 683310c and 4d5ea3b.

Files selected for processing: 18
  • src/atom.rs
  • src/meta/iinf.rs
  • src/meta/mod.rs
  • src/moov/mod.rs
  • src/moov/trak/mdia/minf/dinf/dref/mod.rs
  • src/moov/trak/mdia/minf/dinf/dref/urn.rs
  • src/test/av1.rs
  • src/test/av1_mdta.rs
  • src/test/bbb.rs
  • src/test/esds.rs
  • src/test/flac.rs
  • src/test/h264.rs
  • src/test/hevc.rs
  • src/test/libavif_anim.rs
  • src/test/mebx.rs
  • src/test/uncompressed.rs
  • src/test/vp9.rs
  • src/tokio/atom.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@bradh
bradh merged commit aaac5a1 into main Oct 30, 2026
2 checks passed
@bradh
bradh deleted the codex/fix-typed-atom-fourcc-dref branch October 30, 2026 06:29
@github-actions github-actions Bot mentioned this pull request Oct 30, 2026
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

2 participants