summaryrefslogtreecommitdiff
path: root/libavformat/moflex.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-10-02 14:59:15 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2020-10-04 16:54:11 +0200
commitacd735efaf0ceba95c3f07751182af485af993d2 (patch)
tree1432eeeec5779b0c158d7694ce8c5473cccd9f5e /libavformat/moflex.c
parent3291d994b76db4b6e67c8467367ce68f79785e60 (diff)
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@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat/moflex.c')
-rw-r--r--libavformat/moflex.c5
1 files changed, 4 insertions, 1 deletions
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;