]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/escape124.c
Merge commit '5c8a5765dc5f4e29afb85b95be393c30f45412a8'
[ffmpeg] / libavcodec / escape124.c
index c3174ce6ef94c91bad5f5f74c9dd05bdf0e0431e..eb051eba54a5a006aafc86f089b3b940cf2db096 100644 (file)
@@ -267,6 +267,11 @@ static int escape124_decode_frame(AVCodecContext *avctx,
                     cb_size = s->num_superblocks << cb_depth;
                 }
             }
+            if (s->num_superblocks >= INT_MAX >> cb_depth) {
+                av_log(avctx, AV_LOG_ERROR, "Depth or num_superblocks are too large\n");
+                return AVERROR_INVALIDDATA;
+            }
+
             av_freep(&s->codebooks[i].blocks);
             s->codebooks[i] = unpack_codebook(&gb, cb_depth, cb_size);
             if (!s->codebooks[i].blocks)