avformat/avidec: Check avio_read() return before using the results for meta-data
authorMichael Niedermayer <michaelni@gmx.at>
Thu, 5 Mar 2015 18:31:56 +0000 (19:31 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Thu, 5 Mar 2015 18:38:20 +0000 (19:38 +0100)
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavformat/avidec.c

index 8a0938d..5c9443a 100644 (file)
@@ -308,7 +308,8 @@ static int avi_read_tag(AVFormatContext *s, AVStream *st, uint32_t tag,
     value = av_malloc(size + 1);
     if (!value)
         return AVERROR(ENOMEM);
-    avio_read(pb, value, size);
+    if (avio_read(pb, value, size) != size)
+        return AVERROR_INVALIDDATA;
     value[size] = 0;
 
     AV_WL32(key, tag);