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>
Fri, 13 Mar 2015 16:06:08 +0000 (17:06 +0100)
Found-by: Paul Mehta <paul@paulmehta.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit 3859868c75313e318ebc5d0d33baada62d45dd75)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/mov.c

index dd5352e..df3dc39 100644 (file)
@@ -388,7 +388,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;
 
     str_size = FFMIN3(sizeof(str)-1, str_size, atom.size);