]> git.sesse.net Git - ffmpeg/commitdiff
avformat/rpl: Check the number of streams
authorMichael Niedermayer <michael@niedermayer.cc>
Tue, 8 Dec 2020 23:49:29 +0000 (00:49 +0100)
committerMichael Niedermayer <michael@niedermayer.cc>
Wed, 9 Dec 2020 20:41:15 +0000 (21:41 +0100)
Fixes: out of memory access
Fixes: 27787/clusterfuzz-testcase-minimized-ffmpeg_dem_RPL_fuzzer-4743666463408128.fuzz
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>
libavformat/rpl.c

index c79419d558e1b72c81b5a8edee6c2f010bac22d4..b98488c7b17be0f862adb15284fb92149b07a851 100644 (file)
@@ -253,6 +253,9 @@ static int rpl_read_header(AVFormatContext *s)
             error |= read_line(pb, line, sizeof(line));
     }
 
+    if (s->nb_streams == 0)
+        return AVERROR_INVALIDDATA;
+
     rpl->frames_per_chunk = read_line_and_int(pb, &error);  // video frames per chunk
     if (vst && rpl->frames_per_chunk > 1 && vst->codecpar->codec_tag != 124)
         av_log(s, AV_LOG_WARNING,