]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/zmbv.c
Merge commit 'e6bff23f1e11aefb16a2b5d6ee72bf7469c5a66e'
[ffmpeg] / libavcodec / zmbv.c
index f126515bd17fdf8a632115fed567aa3d924aa8ef..b09dc41ebd2aea08b21d33ea1998678cf82eef60 100644 (file)
@@ -589,6 +589,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
     // Needed if zlib unused or init aborted before inflateInit
     memset(&c->zstream, 0, sizeof(z_stream));
 
+    if ((avctx->width + 255ULL) * (avctx->height + 64ULL) > FFMIN(avctx->max_pixels, INT_MAX / 4) ) {
+        av_log(avctx, AV_LOG_ERROR, "Internal buffer (decomp_size) larger than max_pixels or too large\n");
+        return AVERROR_INVALIDDATA;
+    }
+
     c->decomp_size = (avctx->width + 255) * 4 * (avctx->height + 64);
 
     /* Allocate decompression buffer */