Commit 9ec7889b23 for ffmpeg

commit 9ec7889b2352e8076ec1c646331d05fd4d820f34
Author: Michael Niedermayer <michael@niedermayer.cc>
Date:   Sat Nov 7 00:25:48 2026 +0100

    tools/qt-faststart: reject a moov atom that starts before the end of the ftyp atom

    Fixes: allocation-size-too-big
    Fixes: mcdSpfadtpED
    Fixes: test_neg5.mov

    Found-by: Hicham Ouabella <ouabe2002hisham@proton.me>

    This is not a security issue.

    Negative allocation size Replicated through UnModified qt-faststart with ASAN

diff --git a/tools/qt-faststart.c b/tools/qt-faststart.c
index 46950a5cf4..a270fa78a9 100644
--- a/tools/qt-faststart.c
+++ b/tools/qt-faststart.c
@@ -571,6 +571,10 @@ int main(int argc, char *argv[])
         perror(argv[1]);
         goto error_out;
     }
+    if (last_offset < start_offset) {
+        fprintf(stderr, "moov atom overlaps the ftyp atom\n");
+        goto error_out;
+    }
     moov_atom_size = atom_size;
     moov_atom      = malloc(moov_atom_size);
     if (!moov_atom) {