avcodec/apac: reset buffer on error

Fixes: repeatly parsing the same data after each 1 byte packet
Fixes: Timeout
Fixes: 51943/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_APAC_fuzzer-5779018251370496

Reviewed-by: Paul B Mahol <onemda@gmail.com>
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 2022-11-16 21:53:45 +01:00
parent 96748ac54f
commit 6634b6ae5f
No known key found for this signature in database
GPG Key ID: B18E8928B3948D64
1 changed files with 2 additions and 0 deletions

View File

@ -191,6 +191,8 @@ static int apac_decode(AVCodecContext *avctx, AVFrame *frame,
if (c->bit_length < 0 ||
c->bit_length > 17) {
c->bit_length = avctx->bits_per_coded_sample;
s->bitstream_index = 0;
s->bitstream_size = 0;
return AVERROR_INVALIDDATA;
}