aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2020-02-23 09:27:27 +0100
committerMichael Niedermayer <michael@niedermayer.cc>2020-07-01 12:49:26 +0200
commit6587933021e6d8d2c616d4d990e1cbb7ffbdd53c (patch)
tree025a1c1813dc68a934759264728092255e3527cb
parent7588b99a3b88d991071ef35011525c01f4438216 (diff)
downloadffmpeg-6587933021e6d8d2c616d4d990e1cbb7ffbdd53c.tar.gz
avformat/mvdec: Check stream numbers
Fixes: null pointer dereference Fixes: 20768/clusterfuzz-testcase-minimized-ffmpeg_DEMUXER_fuzzer-5638648978735104.fuzz Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 618a9bea65112a27a106e02ada3ae475cc8ac1ac) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
-rw-r--r--libavformat/mvdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavformat/mvdec.c b/libavformat/mvdec.c
index e9e9fab503..c2eed0c650 100644
--- a/libavformat/mvdec.c
+++ b/libavformat/mvdec.c
@@ -351,6 +351,12 @@ static int mv_read_header(AVFormatContext *avctx)
if ((ret = read_table(avctx, NULL, parse_global_var)) < 0)
return ret;
+ if (mv->nb_audio_tracks < 0 || mv->nb_video_tracks < 0 ||
+ (mv->nb_audio_tracks == 0 && mv->nb_video_tracks == 0)) {
+ av_log(avctx, AV_LOG_ERROR, "Stream count is invalid.\n");
+ return AVERROR_INVALIDDATA;
+ }
+
if (mv->nb_audio_tracks > 1) {
avpriv_request_sample(avctx, "Multiple audio streams support");
return AVERROR_PATCHWELCOME;