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-29 04:19:27 +0300
committerMichael Niedermayer <michael@niedermayer.cc>2017-01-26 02:34:12 +0300
commit7d222736c27ef7aa0880fc91a51d83dfeac7b388 (patch)
tree30a54a17fd1ebe8bf4a1a4a3df64418e2a6a0a3e /libavcodec/omx.c
parentd5154c055bab178287f44a3625cff0e57c448b84 (diff)
avcodec/omx: Do not pass negative value into av_malloc()
Fixes CID1396849 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc> (cherry picked from commit bd83c295fc1b7f8001e5d134b912af86cd62c3f2) Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/omx.c')
-rw-r--r--libavcodec/omx.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/omx.c b/libavcodec/omx.c
index c1b6fb9847..2fe21429c2 100644
--- a/libavcodec/omx.c
+++ b/libavcodec/omx.c
@@ -761,7 +761,10 @@ static int omx_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
} else {
// If not, we need to allocate a new buffer with the right
// size and copy the input frame into it.
- uint8_t *buf = av_malloc(av_image_get_buffer_size(avctx->pix_fmt, s->stride, s->plane_size, 1));
+ uint8_t *buf = NULL;
+ int image_buffer_size = av_image_get_buffer_size(avctx->pix_fmt, s->stride, s->plane_size, 1);
+ if (image_buffer_size >= 0)
+ buf = av_malloc(image_buffer_size);
if (!buf) {
// Return the buffer to the queue so it's not lost
append_buffer(&s->input_mutex, &s->input_cond, &s->num_free_in_buffers, s->free_in_buffers, buffer);