Harden spatial-media MP4 box parsing #1913

Merged
ljharb opened 6:06am on September 18, 2026 wanted to merge 1 commit into mltframework/shotcut master from
copilot/spatialmedia-mp4-box-type-fix
Diff Delta:
0
Classified as:  General

ljharb's Description of Work #1911 Harden spatial-media MP4 box parsing

All translation updates must go through transifex.com.

Pull requests for those will be rejected.

Crafted MP4/MOV atoms could cause invalid Container casts, mismatched array deallocation, or copying unread heap memory to output. This hardens parsing and metadata injection against malformed box sizes and types.



  • Box ownership and copying


    • Use delete[] for array-backed box contents.

    • Write only bytes successfully read from input.




  • Bounds validation


    • Retain 64-bit extended box sizes through validation.

    • Use subtraction-based bounds checks and reject undersized headers/padding.




  • Container safety


    • Require constants::Container before traversing or modifying container contents.



if (iPos > iEnd || iSize < iHeaderSize

|| iSize > static_cast<uint64_t>(iEnd - iPos))
return NULL;


  • Fixes #1911

5 total changed files
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Loading changes...
Review complete πŸ’ͺ
Like the credits, but with fewer stunts.