[FFmpeg-cvslog] riff: check for eof if chunk size and code are 0

Luca Barbato git at videolan.org
Mon Apr 22 11:51:40 CEST 2013


ffmpeg | branch: master | Luca Barbato <lu_zero at gentoo.org> | Sat Apr 20 13:36:44 2013 +0200| [8e329dba378cef0ff6400c7df9c51da167d5a1f0] | committer: Diego Biurrun

riff: check for eof if chunk size and code are 0

Prevent an infinite loop.

Inspired by a patch from Michael Niedermayer

CC: libav-stable at libav.org

Signed-off-by: Diego Biurrun <diego at biurrun.de>

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

 libavformat/riff.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavformat/riff.c b/libavformat/riff.c
index 694d299..2191c33 100644
--- a/libavformat/riff.c
+++ b/libavformat/riff.c
@@ -785,6 +785,10 @@ int ff_read_riff_info(AVFormatContext *s, int64_t size)
         if (!chunk_code) {
             if (chunk_size)
                 avio_skip(pb, chunk_size);
+            else if (pb->eof_reached) {
+                av_log(s, AV_LOG_WARNING, "truncated file\n");
+                return AVERROR_EOF;
+            }
             continue;
         }
 



More information about the ffmpeg-cvslog mailing list