avformat/mov: bound infe entries by the iinf size #25006

Merged
James Almer merged 1 commit from prasanna8585/FFmpeg:master into master 2026-10-11 19:20:14 +00:00
Contributor

mov_read_iinf() reads each infe sub-box's declared size directly off the bitstream with no check against how much of the enclosing iinf box is actually left, unlike mov_read_iprp() which already bounds its ipco/ipma entries against the remaining iprp size (e3f5f17, 466ea98).

Track the same kind of running size budget here: subtract the version/flags/entry_count header from atom.size up front, then validate each infe_size against what is actually left before trusting it, mirroring e3f5f17's pattern exactly.

No memory-safety issue is known to depend on this; avio already bounds reads to the real file length. This is defense-in-depth, closing the same class of gap the sibling commits above just closed one box over.

Signed-off-by: Prasanna Dabi [email protected]

Summary of changes

Briefly describe what this PR does and why. Bounds each infe entry's declared size against what's actually left in the enclosing iinf box, mirroring the same hardening pattern just applied to ipco/ipma in e3f5f17/466ea98. No crash is known to depend on this — it's defense-in-depth for the same bug class.

mov_read_iinf() reads each infe sub-box's declared size directly off the bitstream with no check against how much of the enclosing iinf box is actually left, unlike mov_read_iprp() which already bounds its ipco/ipma entries against the remaining iprp size (e3f5f17, 466ea98). Track the same kind of running size budget here: subtract the version/flags/entry_count header from atom.size up front, then validate each infe_size against what is actually left before trusting it, mirroring e3f5f17's pattern exactly. No memory-safety issue is known to depend on this; avio already bounds reads to the real file length. This is defense-in-depth, closing the same class of gap the sibling commits above just closed one box over. Signed-off-by: Prasanna Dabi <[email protected]> # Summary of changes Briefly describe what this PR does and why. Bounds each `infe` entry's declared size against what's actually left in the enclosing `iinf` box, mirroring the same hardening pattern just applied to `ipco`/`ipma` in e3f5f17/466ea98. No crash is known to depend on this — it's defense-in-depth for the same bug class. <!-- If this PR requires new FATE test samples, attach them to the PR and list their target paths below (relative to the fate-suite root). Attached filenames must match the sample's filename: ```fate-samples # e.g. vorbis/new-sample.ogg ``` -->
James Almer force-pushed master from 6d7ab3ebfb
Some checks failed
Backport / PR (pull_request_target) Has been skipped
Autolabel / Labeler (pull_request_target) Successful in 10s
Lint / Pre-Commit (pull_request) Successful in 33s
Test / Fate (linux-aarch64, static, 64 bit) (pull_request) Successful in 11m58s
Test / Fate (Full, Linux, aarch64) (pull_request) Successful in 10m9s
Test / Fate (Qemu, Linux, mips64) (pull_request) Successful in 13m24s
Test / Fate (Qemu, Linux, riscv64) (pull_request) Has been cancelled
Test / Fate (Qemu, Linux, ppc64) (pull_request) Has been cancelled
Test / Fate (Full, Wine, win64) (pull_request) Has been cancelled
Test / Fate (linux-amd64, shared, 64 bit) (pull_request) Has been cancelled
Test / Fate (linux-amd64, static, 32 bit) (pull_request) Has been cancelled
to f2051b38c8
All checks were successful
Lint / Pre-Commit (pull_request) Successful in 1m26s
Test / Fate (Full, Linux, aarch64) (pull_request) Successful in 10m9s
Test / Fate (linux-aarch64, static, 64 bit) (pull_request) Successful in 11m50s
Test / Fate (linux-amd64, shared, 64 bit) (pull_request) Successful in 7m25s
Test / Fate (linux-amd64, static, 32 bit) (pull_request) Successful in 13m57s
Test / Fate (Full, Wine, win64) (pull_request) Successful in 31m35s
Test / Fate (Qemu, Linux, mips64) (pull_request) Successful in 13m47s
Test / Fate (Qemu, Linux, ppc64) (pull_request) Successful in 15m50s
Test / Fate (Qemu, Linux, riscv64) (pull_request) Successful in 20m13s
Backport / PR (pull_request_target) Has been skipped
Autolabel / Labeler (pull_request_target) Has been skipped
2026-10-11 17:27:25 +00:00
Compare
James Almer scheduled this pull request to auto merge when all checks succeed 2026-10-11 17:28:24 +00:00
Owner

Changed it a bit (added an extra check for the box type) and applied it. Thanks.

Changed it a bit (added an extra check for the box type) and applied it. Thanks.
Sign in to join this conversation.
No reviewers
No milestone
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
FFmpeg/FFmpeg!25006
No description provided.