Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/FFmpeg/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2016-12-09 01:51:45 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2016-12-11 02:21:53 +0300
commit0e6febff5a7b4d2b823911dd2e04f0bac718ddfb (patch)
tree3643c80fb11e36e8e0f9f3d8b8d34c82d45b9677 /libavcodec/ffv1enc.c
parent3f779aef79b1b92bee569f9813f502798fccd8c8 (diff)
avcodec/ffv1enc: Allocate smaller packet if the worst case size cannot be allocated
We are checking during encoding if there is enough space as version 4 needs that check. Fixes Ticket6005 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit 38a7834bbb24ef62466b076715e0add60e1d6962) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/ffv1enc.c')
-rw-r--r--libavcodec/ffv1enc.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/libavcodec/ffv1enc.c b/libavcodec/ffv1enc.c
index efa0ff7a69..158cbab995 100644
--- a/libavcodec/ffv1enc.c
+++ b/libavcodec/ffv1enc.c
@@ -1144,6 +1144,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;