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

Pull Request Overview

  • Opened on September 18, 2026
  • Status Merged
  • Commit count 1 with first commit September 18, 2026

Total Delta

0 Total Diff Delta

Open Days

Open 1 weekdays

Test Delta

Diff Delta in Test Files
Breakdown by Phase

How long has this pull request spent in each phase of its lifecycle?

Fraction of total time Business days Phase
 
0.0 days Authoring 0 commits before pull request opened for review
 
0.0 days Awaiting first review
 
0.2 days Revising work with 1 commit in response to 0 reviews that left 8 comments
Set up deploy tracking to begin tracking full PR start-to-deploy times

Total time for pull request 0.2 business days from first commit authored to merge
Deploy tracking has not been set up

Author avatar

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

Comments Threads Pending Resolution

Resolved Comment Threads

src/spatialmedia/spatialmedia.cpp
Outdated
309
    if (!inFile || !outFile) {
Unspecified Git Hub Copilot Model
310
        LOG_ERROR() << "Error failed to save spatial media metadata";
Unspecified Git Hub Copilot Model
215 311
        return false;
Unspecified Git Hub Copilot Model
312
    }
Unspecified Git Hub Copilot Model
313
    return true;