From: "Ronald S. Bultje" <[email protected]>

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: [email protected]
---
 libavcodec/aacdec.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index dd9eefc..1eb2a62 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -973,7 +973,8 @@ static int decode_band_types(AACContext *ac, enum BandType 
band_type[120],
                 av_log(ac->avctx, AV_LOG_ERROR, "invalid band type\n");
                 return -1;
             }
-            while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1)
+            while ((sect_len_incr = get_bits(gb, bits)) == (1 << bits) - 1 &&
+                   get_bits_left(gb) >= 0)
                 sect_end += sect_len_incr;
             sect_end += sect_len_incr;
             if (get_bits_left(gb) < 0) {
-- 
1.7.7.4

_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to