Skip to content

Keep a scoped carve's hits inside their free runs - #259

Merged
abrignoni merged 1 commit into
mainfrom
fix/carve-hit-bounds
Oct 1, 2026
Merged

abrignoni merged 1 commit into
mainfrom
fix/carve-hit-bounds

Conversation

@abrignoni

Copy link
Copy Markdown
Owner

Keeps a scoped carve from staging more than the free space it read.

  • Each hit of a scoped carve is cut at the end of its free run, so hits from different runs cannot overlap.
  • Re-vendors mediacarve 0.2.0 (Bound a hit by its ceiling, the stream and a clipped range mediacarve#3): an MP4 box that declares more than its ceiling is capped, no hit runs past the end of the image, and AVI, WebP, MP4 and HEIC get their own ceiling instead of 1 MiB.

The vendored commit is the head of that pull request, so it should merge first, with a merge commit.

🤖 Generated with Claude Code

A scoped carve scans each free run on its own. A hit's length came from the
file's own box sizes, so a hit could run past its run and overlap the hits of
the runs after it, and one ISO-BMFF box with a 64-bit size could declare more
than the disk holds. In staged mode each such hit was copied from its offset
to the end of the image, so the staged copies could outgrow the disk.

The scoped carve now asks the carver to cut each hit at the end of its run.

Re-vendors mediacarve at 0.2.0, which adds that option, caps an ISO-BMFF hit
at its ceiling, ends every hit at the end of the stream, and applies the
ceiling of the kind found. The last one was falling to 1 MiB for AVI, WebP,
MP4 and HEIC: an AVI or WebP over 1 MiB was not carved, and an MP4 whose moov
follows a large mdat was carved without its moov.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@abrignoni
abrignoni merged commit 73ea3f5 into main Oct 1, 2026
8 checks passed
@abrignoni
abrignoni deleted the fix/carve-hit-bounds branch October 1, 2026 20:00
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