diff options
author | Paul B Mahol <onemda@gmail.com> | 2022-11-25 18:34:21 +0100 |
---|---|---|
committer | Paul B Mahol <onemda@gmail.com> | 2022-11-25 18:37:34 +0100 |
commit | 5d7f3b2639923cf054cab917a11ec90ae600ec07 (patch) | |
tree | ab5d4e519671d54a0a804908cbe620d063f97ccc | |
parent | 1a7efafd33b1597d218da64b08fb1144ab65822b (diff) | |
download | ffmpeg-5d7f3b2639923cf054cab917a11ec90ae600ec07.tar.gz |
avcodec/apac: stop adding samples if we run out of bits on EOF
-rw-r--r-- | libavcodec/apac.c | 12 |
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++) { |