avcodec/apac: stop adding samples if we run out of bits on EOF

This commit is contained in:
Paul B Mahol 2022-11-25 18:34:21 +01:00
parent 1a7efafd33
commit 5d7f3b2639
1 changed files with 8 additions and 4 deletions

View File

@ -196,10 +196,14 @@ static int apac_decode(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA; return AVERROR_INVALIDDATA;
} }
if (get_bits_left(gb) < c->block_length * c->bit_length && pkt->size) { if (get_bits_left(gb) < c->block_length * c->bit_length) {
c->have_code = 1; if (pkt->size) {
s->cur_ch = ch; c->have_code = 1;
goto end; s->cur_ch = ch;
goto end;
} else {
break;
}
} }
for (int i = 0; i < c->block_length; i++) { for (int i = 0; i < c->block_length; i++) {