]> git.sesse.net Git - ffmpeg/commitdiff
rawdec: check avpicture_get_size() return value
authorMichael Niedermayer <michaelni@gmx.at>
Tue, 30 Oct 2012 03:35:38 +0000 (04:35 +0100)
committerMichael Niedermayer <michaelni@gmx.at>
Tue, 30 Oct 2012 12:18:57 +0000 (13:18 +0100)
Fixes CID205019
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
libavcodec/rawdec.c

index eb96deb6ae6f7dc07ada9d44ad0c61a76a2dba6d..4d4bce91f2b46e1cee469e69ea8d7b14b8a23f41 100644 (file)
@@ -113,11 +113,15 @@ static av_cold int raw_init_decoder(AVCodecContext *avctx)
        avctx->pix_fmt==AV_PIX_FMT_PAL8 &&
        (!avctx->codec_tag || avctx->codec_tag == MKTAG('r','a','w',' '))){
         context->length = avpicture_get_size(avctx->pix_fmt, FFALIGN(avctx->width, 16), avctx->height);
+        if (context->length < 0)
+            return context->length;
         context->buffer = av_malloc(context->length);
         if (!context->buffer)
             return AVERROR(ENOMEM);
     } else {
         context->length = avpicture_get_size(avctx->pix_fmt, avctx->width, avctx->height);
+        if (context->length < 0)
+            return context->length;
     }
     context->pic.pict_type = AV_PICTURE_TYPE_I;
     context->pic.key_frame = 1;