Skip to content

Commit

Permalink
avcodec/vqavideo: reset accounting on error
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
michaelni committed Dec 23, 2021
1 parent 60ead5c commit d8ea7a6
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions libavcodec/vqavideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -608,13 +608,14 @@ static int vqa_decode_frame_pal8(VqaContext *s, AVFrame *frame)
if (s->partial_countdown <= 0) {
bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index);
/* decompress codebook */
if ((res = decode_format80(s, s->next_codebook_buffer_index,
s->codebook, s->codebook_size, 0)) < 0)
return res;
res = decode_format80(s, s->next_codebook_buffer_index,
s->codebook, s->codebook_size, 0);

/* reset accounting */
s->next_codebook_buffer_index = 0;
s->partial_countdown = s->partial_count;
if (res < 0)
return res;
}
}

Expand Down

0 comments on commit d8ea7a6

Please sign in to comment.