Commit 618a9bea authored by Michael Niedermayer's avatar Michael Niedermayer

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/ffmpegReviewed-by: 's avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Signed-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent f701414b
...@@ -363,6 +363,12 @@ static int mv_read_header(AVFormatContext *avctx) ...@@ -363,6 +363,12 @@ static int mv_read_header(AVFormatContext *avctx)
if ((ret = read_table(avctx, NULL, parse_global_var)) < 0) if ((ret = read_table(avctx, NULL, parse_global_var)) < 0)
return ret; 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) { if (mv->nb_audio_tracks > 1) {
avpriv_request_sample(avctx, "Multiple audio streams support"); avpriv_request_sample(avctx, "Multiple audio streams support");
return AVERROR_PATCHWELCOME; return AVERROR_PATCHWELCOME;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment