avcodec/tta: Don't try to read more than MIN_CACHE_BITS bits
authorJames Almer <jamrial@gmail.com>
Fri, 7 Apr 2017 15:48:31 +0000 (12:48 -0300)
committerJames Almer <jamrial@gmail.com>
Fri, 7 Apr 2017 15:52:17 +0000 (12:52 -0300)
This fixes assertion failures introduced in 4fbb56acbe.

Reviewed-by: michaelni
Reviewed-by: durandal_1707
libavcodec/tta.c

index 118b9f7..8f097b3 100644 (file)
@@ -285,7 +285,7 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
         }
 
         if (k) {
-            if (k >= 32 || unary > INT32_MAX >> k) {
+            if (k > MIN_CACHE_BITS || unary > INT32_MAX >> k) {
                 ret = AVERROR_INVALIDDATA;
                 goto error;
             }