]> git.sesse.net Git - ffmpeg/blobdiff - libavcodec/ffv1enc.c
avcodec/qdrw: add support for 0x0001 code
[ffmpeg] / libavcodec / ffv1enc.c
index ee707f2b8627ef47bd2e3b96ec2df8fc227670cf..35f54c6ff9122731a1873d99da14247cb475a787 100644 (file)
@@ -1151,6 +1151,11 @@ static int encode_frame(AVCodecContext *avctx, AVPacket *pkt,
     if (f->version > 3)
         maxsize = AV_INPUT_BUFFER_MIN_SIZE + avctx->width*avctx->height*3LL*4;
 
+    if (maxsize > INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32) {
+        av_log(avctx, AV_LOG_WARNING, "Cannot allocate worst case packet size, the encoding could fail\n");
+        maxsize = INT_MAX - AV_INPUT_BUFFER_PADDING_SIZE - 32;
+    }
+
     if ((ret = ff_alloc_packet2(avctx, pkt, maxsize, 0)) < 0)
         return ret;