From 1490682bcb0fe359e05b85bb7198bb87be686054 Mon Sep 17 00:00:00 2001 From: Paul B Mahol Date: Fri, 8 Apr 2016 12:45:40 +0200 Subject: avcodec/pngenc: check return value of av_frame_copy() Signed-off-by: Paul B Mahol --- libavcodec/pngenc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'libavcodec') diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c index 2ee43c52a3..00c830e6eb 100644 --- a/libavcodec/pngenc.c +++ b/libavcodec/pngenc.c @@ -768,7 +768,9 @@ static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, if (last_fctl_chunk.dispose_op != APNG_DISPOSE_OP_PREVIOUS) { diffFrame->width = pict->width; diffFrame->height = pict->height; - av_frame_copy(diffFrame, s->last_frame); + ret = av_frame_copy(diffFrame, s->last_frame); + if (ret < 0) + goto fail; if (last_fctl_chunk.dispose_op == APNG_DISPOSE_OP_BACKGROUND) { for (y = last_fctl_chunk.y_offset; y < last_fctl_chunk.y_offset + last_fctl_chunk.height; ++y) { @@ -782,7 +784,9 @@ static int apng_encode_frame(AVCodecContext *avctx, const AVFrame *pict, diffFrame->width = pict->width; diffFrame->height = pict->height; - av_frame_copy(diffFrame, s->prev_frame); + ret = av_frame_copy(diffFrame, s->prev_frame); + if (ret < 0) + goto fail; } // Do inverse blending -- cgit v1.2.3