avcodec/ffv1dec: Check that num h/v slices is supported

Fixes: out of array access
Fixes: 55597/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_FFV1_fuzzer-4898293416329216

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent a02e45a1
......@@ -475,6 +475,11 @@ static int read_extra_header(FFV1Context *f)
return AVERROR_INVALIDDATA;
}
if (f->num_h_slices > MAX_SLICES / f->num_v_slices) {
av_log(f->avctx, AV_LOG_ERROR, "slice count unsupported\n");
return AVERROR_PATCHWELCOME;
}
f->quant_table_count = get_symbol(c, state, 0);
if (f->quant_table_count > (unsigned)MAX_QUANT_TABLES || !f->quant_table_count) {
av_log(f->avctx, AV_LOG_ERROR, "quant table count %d is invalid\n", f->quant_table_count);
......
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