Commit dd2a2a51 authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/diracdec: Count truncated parts as errors in decode_component()

Fixes: Timeout (29sec -> 4sec)
Fixes: 13150/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5690185671507968

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpegSigned-off-by: 's avatarMichael Niedermayer <michael@niedermayer.cc>
parent efe4aef9
...@@ -685,7 +685,10 @@ static int decode_component(DiracContext *s, int comp) ...@@ -685,7 +685,10 @@ static int decode_component(DiracContext *s, int comp)
} }
align_get_bits(&s->gb); align_get_bits(&s->gb);
b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8; b->coeff_data = s->gb.buffer + get_bits_count(&s->gb)/8;
b->length = FFMIN(b->length, FFMAX(get_bits_left(&s->gb)/8, 0)); if (b->length > FFMAX(get_bits_left(&s->gb)/8, 0)) {
b->length = FFMAX(get_bits_left(&s->gb)/8, 0);
damaged_count ++;
}
skip_bits_long(&s->gb, b->length*8); skip_bits_long(&s->gb, b->length*8);
} }
} }
......
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