summaryrefslogtreecommitdiff
path: root/libavcodec/pngenc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2015-10-07 04:50:16 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2015-10-07 04:50:16 +0200
commita852db796edce2792525d88ab47cf78222e01512 (patch)
treef1d75fa4850acde035f30b0888a4df0f90b06881 /libavcodec/pngenc.c
parente96ecaf053d8d606e38ae2e56ba6cf58875021b0 (diff)
avcodec/pngenc: Check that there is at least 1 frame
Fixes null pointer dereference Fixes CID1322330 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavcodec/pngenc.c')
-rw-r--r--libavcodec/pngenc.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavcodec/pngenc.c b/libavcodec/pngenc.c
index 0bae2acfb9..4204df2a30 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);