smacker: Avoid integer overflow when allocating packets
authorMartin Storsjö <martin@martin.st>
Wed, 11 Sep 2013 12:25:13 +0000 (15:25 +0300)
committerMartin Storsjö <martin@martin.st>
Wed, 11 Sep 2013 17:19:43 +0000 (20:19 +0300)
Reported-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable@libav.org
Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/smacker.c

index a15bded..f8a0769 100644 (file)
@@ -327,7 +327,7 @@ static int smacker_read_packet(AVFormatContext *s, AVPacket *pkt)
             }
             flags >>= 1;
         }
             }
             flags >>= 1;
         }
-        if (frame_size < 0)
+        if (frame_size < 0 || frame_size >= INT_MAX/2)
             return AVERROR_INVALIDDATA;
         if (av_new_packet(pkt, frame_size + 769))
             return AVERROR(ENOMEM);
             return AVERROR_INVALIDDATA;
         if (av_new_packet(pkt, frame_size + 769))
             return AVERROR(ENOMEM);