[FFmpeg-cvslog] avformat/moflex: Check m->size before seeking

Michael Niedermayer git at videolan.org
Sun Oct 4 17:59:20 EEST 2020


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Fri Oct  2 14:59:15 2020 +0200| [acd735efaf0ceba95c3f07751182af485af993d2] | committer: Michael Niedermayer

avformat/moflex: Check m->size before seeking

Fixes: Infinite loop
Fixes: 26016/clusterfuzz-testcase-minimized-ffmpeg_IO_DEMUXER_fuzzer-6195663833137152

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Paul B Mahol <onemda at gmail.com>
Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavformat/moflex.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/moflex.c b/libavformat/moflex.c
index 937f63cb63..a24e12eb8e 100644
--- a/libavformat/moflex.c
+++ b/libavformat/moflex.c
@@ -342,8 +342,11 @@ static int moflex_read_packet(AVFormatContext *s, AVPacket *pkt)
 
         m->in_block = 0;
 
-        if (m->flags % 2 == 0)
+        if (m->flags % 2 == 0) {
+            if (m->size <= 0)
+                return AVERROR_INVALIDDATA;
             avio_seek(pb, m->pos + m->size, SEEK_SET);
+        }
     }
 
     return AVERROR_EOF;



More information about the ffmpeg-cvslog mailing list