[FFmpeg-cvslog] avcodec/msrle: check return code for success before use

Michael Niedermayer git at videolan.org
Mon Jun 23 18:52:50 CEST 2014


ffmpeg | branch: release/1.2 | Michael Niedermayer <michaelni at gmx.at> | Sun Apr  6 04:01:24 2014 +0200| [a61998e4f4e1af2d10856ac99f0f8e7a3d56b4d6] | committer: Michael Niedermayer

avcodec/msrle: check return code for success before use

The check is possibly redundant, but better to check for errors
that dont occur than to skip the check and crash

Fixes CID1197060

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
(cherry picked from commit 754f84663e8b3a88fa2e953b195d59230393fb8d)

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

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

 libavcodec/msrle.c |    3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index a836e33..c1498b5 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -118,6 +118,9 @@ static int msrle_decode_frame(AVCodecContext *avctx,
         uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
         int i, j;
 
+        if (linesize < 0)
+            return linesize;
+
         for (i = 0; i < avctx->height; i++) {
             if (avctx->bits_per_coded_sample == 4) {
                 for (j = 0; j < avctx->width - 1; j += 2) {



More information about the ffmpeg-cvslog mailing list