[FFmpeg-cvslog] avcodec/pngenc: Check that there is at least 1 frame

Michael Niedermayer git at videolan.org
Wed Oct 7 05:02:12 CEST 2015


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Wed Oct  7 04:50:16 2015 +0200| [a852db796edce2792525d88ab47cf78222e01512] | committer: Michael Niedermayer

avcodec/pngenc: Check that there is at least 1 frame

Fixes null pointer dereference
Fixes CID1322330

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

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

 libavcodec/pngenc.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 0bae2ac..4204df2 100644
--- a/libavcodec/pngenc.c
+++ b/libavcodec/pngenc.c
@@ -842,6 +842,9 @@ static int encode_apng(AVCodecContext *avctx, AVPacket *pkt,
         return AVERROR(ENOMEM);
 
     if (avctx->frame_number == 0) {
+        if (!pict)
+            return AVERROR(EINVAL);
+
         s->bytestream = avctx->extradata = av_malloc(FF_MIN_BUFFER_SIZE);
         if (!avctx->extradata)
             return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list