]> git.sesse.net Git - ffmpeg/commitdiff
avformat/moflex: Check pkt_size
authorMichael Niedermayer <michael@niedermayer.cc>
Sat, 24 Oct 2020 22:23:07 +0000 (00:23 +0200)
committerMichael Niedermayer <michael@niedermayer.cc>
Sun, 22 Nov 2020 16:45:17 +0000 (17:45 +0100)
Fixes: Timeout (>20sec -> 1ms)
Fixes: 26527/clusterfuzz-testcase-minimized-ffmpeg_dem_MOFLEX_fuzzer-6308307310215168
Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/moflex.c

index a24e12eb8ec555523f08192321156c437f99f1fb..8142925adc960a7cc856a3c5fe86afb21d7076ce 100644 (file)
@@ -316,6 +316,8 @@ static int moflex_read_packet(AVFormatContext *s, AVPacket *pkt)
             }
 
             pkt_size = pop_int(br, pb, 13) + 1;
+            if (pkt_size > m->size)
+                return AVERROR_INVALIDDATA;
             packet   = s->streams[stream_index]->priv_data;
             if (!packet) {
                 avio_skip(pb, pkt_size);