Skip to content

feat: Reader offset-aware fragment verification; prepare 0.37.13.dev1 - #5

Merged
mstattma merged 3 commits into
feat/trusted-vsi-functionalfrom
feat/trusted-vsi-fragment-offset
Oct 15, 2026
Merged

mstattma merged 3 commits into
feat/trusted-vsi-functionalfrom
feat/trusted-vsi-fragment-offset

Conversation

@mstattma

Copy link
Copy Markdown

For signer 1.0.8.

  • d4782fa binds native c2pa_reader_with_fragment_at_offset / c2pa_reader_fragment_at_offset_supported (feat: 1.0.8 native line (dependency advisories, default EKUs, offset-aware fMP4 fragments + FFI) c2pa-rs#20): optional symbols, lazily cached has_fragment_at_offset(), Reader.from_fragment_at_offset(format, init_stream, fragment_stream, fragment_offset, context=None) and Reader.with_fragment_at_offset(...). 65 new tests (58 scripted, 7 real-native); trusted VSI paired 207 pass; regressions clean in cbor2 5.9 and 6.1.2. Independent review: no findings.
  • fb08982 release prep for castlabs-v0.37.13.dev1 on native 3328b2b4 (SDK 0.92.0-dev, toolchain 1.96.0, Cargo.lock f7022b3e…, release branch feat/trusted-vsi-functional); release smoke requires the fragment-offset capability; paired workflow moves to the same native.

Merge (true merge) before tagging castlabs-v0.37.13.dev1.

…gment_at_offset)

Bind the Castlabs native c2pa_reader_with_fragment_at_offset(reader, format,
stream, fragment, uint64 offset) and the c2pa_reader_fragment_at_offset_supported
probe as optional symbols, so older native libraries still import.

- has_fragment_at_offset(): true only when both exports exist and the probe
  returns true. The probe is called lazily on first use, never at import.
- Reader.from_fragment_at_offset(format, init_stream, fragment_stream,
  fragment_offset, context=None) and Reader.with_fragment_at_offset(format,
  stream, fragment_stream, fragment_offset). They follow with_fragment
  ownership: the native call consumes the reader on success and failure.
  Gating raises C2paError.NotSupported before any argument or native work.
  The format must be a non-empty str (native fragment loading cannot
  auto-detect). The offset must be an int in 0..2**64-1 (bool rejected).
  The streams must be stream-like and distinct objects, and the context
  valid; all of this is checked before any native call. A wrong cut or
  offset gives an Invalid reader with assertion.bmffHash.mismatch.
- Tests: scripted gating, validation and marshalling, plus real-native
  checks. Those sign the per-fragment-sidx single-file fixture (copied from
  castlabs/c2pa-rs ec9ac2f6), cut it at merkle uuid boundaries, verify each
  segment Trusted with bmffHash.match, and check wrong offsets
  (0, +/-1, sibling) are a mismatch. The real-native tests skip when the
  API is absent and fail under C2PA_FRAGMENT_OFFSET_REQUIRED=1.
- Docs: README, usage and release notes.
@mstattma
mstattma merged commit 78771fa into feat/trusted-vsi-functional Oct 15, 2026
18 checks passed
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