[FFmpeg-cvslog] avcodec/pngenc: check return value of av_frame_copy()

Paul B Mahol git at videolan.org
Fri Apr 8 12:46:43 CEST 2016


ffmpeg | branch: master | Paul B Mahol <onemda at gmail.com> | Fri Apr  8 12:45:40 2016 +0200| [1490682bcb0fe359e05b85bb7198bb87be686054] | committer: Paul B Mahol

avcodec/pngenc: check return value of av_frame_copy()

Signed-off-by: Paul B Mahol <onemda at gmail.com>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1490682bcb0fe359e05b85bb7198bb87be686054
---

 libavcodec/pngenc.c |    8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 2ee43c5..00c830e 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



More information about the ffmpeg-cvslog mailing list