avcodec/diracdec: check that GetBitContext has not ended in codeblock()

Fixes: Timeout (part 2 of 2)
Fixes: 9774/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_DIRAC_fuzzer-5748957085958144

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2018-09-14 00:22:13 +02:00
parent 7274d849cc
commit 179ed2d2e0
1 changed files with 2 additions and 0 deletions

View File

@ -548,6 +548,8 @@ static inline int codeblock(DiracContext *s, SubBand *b,
} }
} else { } else {
for (y = top; y < bottom; y++) { for (y = top; y < bottom; y++) {
if (get_bits_left(gb) < 1)
return AVERROR_INVALIDDATA;
for (x = left; x < right; x++) { for (x = left; x < right; x++) {
int val = coeff_unpack_golomb(gb, qfactor, qoffset); int val = coeff_unpack_golomb(gb, qfactor, qoffset);
if (b->pshift) { if (b->pshift) {