Skip to content

Port upstream #382: gate the ISOBMFF byte scan on an 8-byte tail - #32

Merged
ivanusto merged 1 commit into
mainfrom
upstream-382
Oct 11, 2026
Merged

ivanusto merged 1 commit into
mainfrom
upstream-382

Conversation

@ivanusto

Copy link
Copy Markdown
Owner

Upstream #382 fixes an off-by-a-header in #371, which v0.9.0 ported: the whole-file C2PA byte scan and the content-provenance user-type scan ran whenever the box walk ended before EOF. The walk needs 8 bytes to read a header, so a complete MP4, AVIF or HEIC with 1 to 7 bytes of padding re-enabled both scans, and chance c2pa bytes in the media were reported as a manifest.

  • js/image_meta.js (inspectIsobmff, buffer driver) and js/av_meta.js (inspectMp4File, slice driver): len - scannedEnd >= 8.
  • New parity fixtures: tails of 1, 4, 7 (non-zero) and 8 bytes for both scans in MP4 and AVIF, and a content-provenance box truncated before any ASCII marker. Twelve fail against the old gate; the 8-byte and truncated cases pass under both, as they should.
  • scripts/upstream-sources.json: image_meta.py re-anchored to upstream c5297e9, comment updated.

Not ported from the same range: #375 (SKILL.md), #376 (ruff bump), #379 (Codex skill installer).

Tests: 1778 passed, 0 skipped, against upstream c5297e9; check-upstream.mjs reports all 12 sources matching.

Closes #31

#371 limited the whole-file C2PA scan and the content-provenance user-type
scan to a box walk that stopped early, but tested that as "stopped before
the end of the data". The walk runs while pos + 8 <= length, so a complete
container with 1 to 7 bytes of trailing padding passed the test and chance
marker bytes in its media were reported as a manifest. Require at least 8
bytes left over, the room for a box header and the threshold the strip
side already uses. Both drivers follow it.

New fixtures cover tails of 1, 4, 7 and 8 bytes for the ASCII-marker and
user-type scans, in MP4 and AVIF, plus a content-provenance box truncated
before any ASCII marker. Twelve of them fail with the old gate.
@ivanusto
ivanusto merged commit a114071 into main Oct 11, 2026
2 checks passed
@ivanusto
ivanusto deleted the upstream-382 branch October 11, 2026 04:10
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.

Ports are out of sync with upstream watermarks-remover

1 participant