avformat/flacdec: Check avio_read result when reading flac block header.
authorFrank Liberato <liberato@chromium.org>
Tue, 24 Jan 2017 18:58:17 +0000 (10:58 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 8 Feb 2017 19:32:01 +0000 (20:32 +0100)
Return AVERROR_INVALIDDATA if all four bytes aren't present.

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 95bde49982a82bc10470c0adab5969ffe635d064)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/flacdec.c

index 3060dc4..66baba5 100644 (file)
@@ -65,7 +65,8 @@ static int flac_read_header(AVFormatContext *s)
 
     /* process metadata blocks */
     while (!avio_feof(s->pb) && !metadata_last) {
-        avio_read(s->pb, header, 4);
+        if (avio_read(s->pb, header, 4) != 4)
+            return AVERROR(AVERROR_INVALIDDATA);
         flac_parse_block_header(header, &metadata_last, &metadata_type,
                                    &metadata_size);
         switch (metadata_type) {