avcodec/diracdec: Check component quant

Fixes: Timeout
Fixes: 10708/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5730140957442048

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2018-11-14 09:42:44 +01:00
parent 1035206102
commit 28c96c2ce2
1 changed files with 5 additions and 0 deletions

View File

@ -676,6 +676,11 @@ static int decode_component(DiracContext *s, int comp)
b->length = get_interleaved_ue_golomb(&s->gb);
if (b->length) {
b->quant = get_interleaved_ue_golomb(&s->gb);
if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
b->quant = 0;
return AVERROR_INVALIDDATA;
}
align_get_bits(&s->gb);
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));