[libav-commits] raw: forward avpicture_fill() error code in raw_decode().

Ronald S. Bultje git at libav.org
Sun Apr 29 22:09:10 CEST 2012


Module: libav
Branch: release/0.8
Commit: 29d91e9161156f4d0df42279de1b6d7c296133f6

Author:    Ronald S. Bultje <rsbultje at gmail.com>
Committer: Reinhard Tartler <siretart at tauware.de>
Date:      Mon Mar 26 18:02:08 2012 -0700

raw: forward avpicture_fill() error code in raw_decode().

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
CC: libav-stable at libav.org
(cherry picked from commit 98df2e24141cd00a557ef10ed7af2b956200cd80)

Signed-off-by: Reinhard Tartler <siretart at tauware.de>

---

 libavcodec/rawdec.c |    5 ++++-
 1 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavcodec/rawdec.c b/libavcodec/rawdec.c
index 83b2a21..c0508d8 100644
--- a/libavcodec/rawdec.c
+++ b/libavcodec/rawdec.c
@@ -119,6 +119,7 @@ static int raw_decode(AVCodecContext *avctx,
     const uint8_t *buf = avpkt->data;
     int buf_size = avpkt->size;
     RawVideoContext *context = avctx->priv_data;
+    int res;
 
     AVFrame * frame = (AVFrame *) data;
     AVPicture * picture = (AVPicture *) data;
@@ -156,7 +157,9 @@ static int raw_decode(AVCodecContext *avctx,
        avctx->codec_tag == MKTAG('A', 'V', 'u', 'p'))
         buf += buf_size - context->length;
 
-    avpicture_fill(picture, buf, avctx->pix_fmt, avctx->width, avctx->height);
+    if ((res = avpicture_fill(picture, buf, avctx->pix_fmt,
+                              avctx->width, avctx->height)) < 0)
+        return res;
     if((avctx->pix_fmt==PIX_FMT_PAL8 && buf_size < context->length) ||
        (avctx->pix_fmt!=PIX_FMT_PAL8 &&
         (av_pix_fmt_descriptors[avctx->pix_fmt].flags & PIX_FMT_PAL))){



More information about the libav-commits mailing list