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;
}
if (get_bits_left(gb) < c->block_length * c->bit_length && pkt->size) {
c->have_code = 1;
s->cur_ch = ch;
goto end;
if (get_bits_left(gb) < c->block_length * c->bit_length) {
if (pkt->size) {
c->have_code = 1;
s->cur_ch = ch;
goto end;
} else {
break;
}
}
for (int i = 0; i < c->block_length; i++) {