[FFmpeg-cvslog] rawdec: check avpicture_get_size() return value

Michael Niedermayer git at videolan.org
Tue Oct 30 13:22:27 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Oct 30 04:35:38 2012 +0100| [60e957476e338a200501e0bdad40b7bf0076b268] | committer: Michael Niedermayer

rawdec: check avpicture_get_size() return value

Fixes CID205019
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/rawdec.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index eb96deb..4d4bce9 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -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;



More information about the ffmpeg-cvslog mailing list