Browse code

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@gmx.at>
(cherry picked from commit 754f84663e8b3a88fa2e953b195d59230393fb8d)

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

Michael Niedermayer authored on 2014/04/06 11:01:24
Showing 1 changed files
... ...
@@ -116,6 +116,9 @@ static int msrle_decode_frame(AVCodecContext *avctx,
116 116
         uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
117 117
         int i, j;
118 118
 
119
+        if (linesize < 0)
120
+            return linesize;
121
+
119 122
         for (i = 0; i < avctx->height; i++) {
120 123
             if (avctx->bits_per_coded_sample == 4) {
121 124
                 for (j = 0; j < avctx->width - 1; j += 2) {