avcodec/vqavideo: reset accounting on error

Fixes: Timeout (same growing chunk is decoded to failure repeatedly)
Fixes: 42582/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_VQA_fuzzer-6531195591065600

Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit d8ea7a67ba)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2021-12-19 22:26:00 +01:00
parent e546e9c5b4
commit 7caa166ac3
1 changed files with 4 additions and 3 deletions

View File

@ -588,13 +588,14 @@ static int vqa_decode_chunk(VqaContext *s, AVFrame *frame)
if (s->partial_countdown <= 0) { if (s->partial_countdown <= 0) {
bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index); bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index);
/* decompress codebook */ /* decompress codebook */
if ((res = decode_format80(s, s->next_codebook_buffer_index, res = decode_format80(s, s->next_codebook_buffer_index,
s->codebook, s->codebook_size, 0)) < 0) s->codebook, s->codebook_size, 0);
return res;
/* reset accounting */ /* reset accounting */
s->next_codebook_buffer_index = 0; s->next_codebook_buffer_index = 0;
s->partial_countdown = s->partial_count; s->partial_countdown = s->partial_count;
if (res < 0)
return res;
} }
} }