diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c index 750e54ae99..9f0cac61e3 100644 --- a/libavcodec/msrle.c +++ b/libavcodec/msrle.c @@ -116,6 +116,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) {