Commit 880f5c59 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/diracdec: Check weight_log2denom

Fixes: runtime error: shift exponent -1 is negative
Fixes: 2742/clusterfuzz-testcase-minimized-5724322402402304
Fixes: 2744/clusterfuzz-testcase-minimized-4672435653705728
Fixes: 2749/clusterfuzz-testcase-minimized-5298741273690112

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent 46e40755
......@@ -1179,6 +1179,11 @@ static int dirac_unpack_prediction_parameters(DiracContext *s)
if (get_bits1(gb)) {
s->weight_log2denom = get_interleaved_ue_golomb(gb);
if (s->weight_log2denom < 1 || s->weight_log2denom > 8) {
av_log(s->avctx, AV_LOG_ERROR, "weight_log2denom unsupported or invalid\n");
s->weight_log2denom = 1;
return AVERROR_INVALIDDATA;
}
s->weight[0] = dirac_get_se_golomb(gb);
if (s->num_refs == 2)
s->weight[1] = dirac_get_se_golomb(gb);
......
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