]> git.sesse.net Git - ffmpeg/commitdiff
mov: Fix negative size calculation in mov_read_default().
authorDale Curtis <dalecurtis@chromium.org>
Tue, 6 Jan 2015 00:34:17 +0000 (16:34 -0800)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Jan 2015 04:23:45 +0000 (05:23 +0100)
The previous code assumed if an atom was marked with a 64-bit
size extension, it actually had that data available. The new
code verfies there's enough data in the atom for this to be
done.

Failure to verify causes total_size > atom.size which will
result in negative size calculations later on.

Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index f2a66b8a95be9eb182d39d02dda98173bd4551f7..a157d603309ded599fb5ce50155b121e043627d5 100644 (file)
@@ -3471,7 +3471,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
                 }
             }
             total_size += 8;
-            if (a.size == 1) { /* 64 bit extended size */
+            if (a.size == 1 && total_size + 8 <= atom.size) { /* 64 bit extended size */
                 a.size = avio_rb64(pb) - 8;
                 total_size += 8;
             }