avformat/mov: fix integer overflow in mov_read_udta_string()
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Jan 2015 03:29:10 +0000 (04:29 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 6 Jan 2015 03:44:16 +0000 (04:44 +0100)
Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index ba79378..f2a66b8 100644 (file)
@@ -375,7 +375,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     if (!key)
         return 0;
-    if (atom.size < 0)
+    if (atom.size < 0 || str_size >= INT_MAX/2)
         return AVERROR_INVALIDDATA;
 
     // worst-case requirement for output string in case of utf8 coded input