aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaul B Mahol <onemda@gmail.com>2022-11-25 18:34:21 +0100
committerPaul B Mahol <onemda@gmail.com>2022-11-25 18:37:34 +0100
commit5d7f3b2639923cf054cab917a11ec90ae600ec07 (patch)
treeab5d4e519671d54a0a804908cbe620d063f97ccc
parent1a7efafd33b1597d218da64b08fb1144ab65822b (diff)
downloadffmpeg-5d7f3b2639923cf054cab917a11ec90ae600ec07.tar.gz
avcodec/apac: stop adding samples if we run out of bits on EOF
-rw-r--r--libavcodec/apac.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/libavcodec/apac.c b/libavcodec/apac.c
index e9f6a0dd88..784abb622c 100644
--- a/libavcodec/apac.c
+++ b/libavcodec/apac.c
@@ -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++) {