avformat/electronicarts: check chunk size.
authorMichael Niedermayer <michaelni@gmx.at>
Mon, 11 Nov 2013 18:51:12 +0000 (19:51 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Mon, 11 Nov 2013 18:51:12 +0000 (19:51 +0100)
Fix infinite loop

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

index 97c19c9..3694a02 100644 (file)
@@ -361,6 +361,11 @@ static int process_ea_header(AVFormatContext *s)
         if (ea->big_endian)
             size = av_bswap32(size);
 
+        if (size < 8) {
+            av_log(s, AV_LOG_ERROR, "chunk size too small\n");
+            return AVERROR_INVALIDDATA;
+        }
+
         switch (blockid) {
         case ISNh_TAG:
             if (avio_rl32(pb) != EACS_TAG) {