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

Fixes null pointer dereference
Fixes CID1322330

Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
Michael Niedermayer 2015-10-07 04:50:16 +02:00
parent e96ecaf053
commit a852db796e
1 changed files with 3 additions and 0 deletions

View File

@ -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);