diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2014-12-11 13:55:26 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2014-12-11 17:14:15 +0100 |
commit | f96fcba1e3bc991245e2cd44a40968bf2ffe4d9f (patch) | |
tree | b896f6dd14351e21495e3723bd7cfb6b926b2a2f /libavcodec | |
parent | 086e29a01119a0108b26568ec1f66bc66ae9c0f7 (diff) | |
download | ffmpeg-f96fcba1e3bc991245e2cd44a40968bf2ffe4d9f.tar.gz |
avcodec/libutvideoenc: Check avpicture_get_size() return code
Fixes CID1257656
Reviewed-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec')
-rw-r--r-- | libavcodec/libutvideoenc.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/libavcodec/libutvideoenc.cpp b/libavcodec/libutvideoenc.cpp index 3deb1c7a58..b430a44d1e 100644 --- a/libavcodec/libutvideoenc.cpp +++ b/libavcodec/libutvideoenc.cpp @@ -39,6 +39,7 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) UtVideoContext *utv = (UtVideoContext *)avctx->priv_data; UtVideoExtra *info; uint32_t flags, in_format; + int ret; switch (avctx->pix_fmt) { case AV_PIX_FMT_YUV420P: @@ -94,8 +95,11 @@ static av_cold int utvideo_encode_init(AVCodecContext *avctx) * We use this buffer to hold the data that Ut Video returns, * since we cannot decode planes separately with it. */ - utv->buf_size = avpicture_get_size(avctx->pix_fmt, - avctx->width, avctx->height); + ret = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height); + if (ret < 0) + return ret; + utv->buf_size = ret; + utv->buffer = (uint8_t *)av_malloc(utv->buf_size); if (utv->buffer == NULL) { |