avformat/mvdec: Check bytes_per_sample

Fixes: division by zero
Fixes: 42814/clusterfuzz-testcase-minimized-ffmpeg_dem_MV_fuzzer-4787014237552640

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Reviewed-by: Peter Ross <pross@xvid.org>
Reviewed-by: John-Paul Stewart <jpstewart@personalprojects.net>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-12-23 20:43:47 +01:00
parent 10add8bb66
commit f3a949dc4c

View file

@ -366,6 +366,9 @@ static int mv_read_header(AVFormatContext *avctx)
avpriv_request_sample(avctx, "Audio compression (format %i)", v);
}
if (bytes_per_sample == 0)
return AVERROR_INVALIDDATA;
if (set_channels(avctx, ast, avio_rb32(pb)) < 0)
return AVERROR_INVALIDDATA;