OSDN Git Service

riff: retry reading metadata without padding if it fails with
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 18 Oct 2012 02:58:20 +0000 (04:58 +0200)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 18 Oct 2012 14:03:16 +0000 (16:03 +0200)
Fixes Ticket1821

Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/riff.c

index ee3542c..769a4d6 100644 (file)
@@ -771,8 +771,13 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
         chunk_code = avio_rl32(pb);
         chunk_size = avio_rl32(pb);
         if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) {
-            av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n");
-            return AVERROR_INVALIDDATA;
+            avio_seek(pb, -9, SEEK_CUR);
+            chunk_code = avio_rl32(pb);
+            chunk_size = avio_rl32(pb);
+            if (chunk_size > end || end - chunk_size < cur || chunk_size == UINT_MAX) {
+                av_log(s, AV_LOG_ERROR, "too big INFO subchunk\n");
+                return AVERROR_INVALIDDATA;
+            }
         }
 
         chunk_size += (chunk_size & 1);