[FFmpeg-cvslog] avformat/flacdec: Check avio_read result when reading flac block header.

Frank Liberato git at videolan.org
Wed Feb 8 21:50:24 EET 2017


ffmpeg | branch: release/3.1 | Frank Liberato <liberato at chromium.org> | Tue Jan 24 10:58:17 2017 -0800| [197e4693f634d9e61eb61851e217d1b15a9d481b] | committer: Michael Niedermayer

avformat/flacdec: Check avio_read result when reading flac block header.

Return AVERROR_INVALIDDATA if all four bytes aren't present.

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
(cherry picked from commit 95bde49982a82bc10470c0adab5969ffe635d064)
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=197e4693f634d9e61eb61851e217d1b15a9d481b
---

 libavformat/flacdec.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/flacdec.c b/libavformat/flacdec.c
index 3060dc4..66baba5 100644
--- a/libavformat/flacdec.c
+++ b/libavformat/flacdec.c
@@ -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) {



More information about the ffmpeg-cvslog mailing list