From 8ad9b48c9b5b749df8fbcd59d61278caadc478ca Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sat, 17 Nov 2012 04:45:38 +0100 Subject: [PATCH] xxan: check ybuf index before use. Fixes out of array access Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/xxan.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/xxan.c b/libavcodec/xxan.c index de1ea7f0e4..2c33f07a71 100644 --- a/libavcodec/xxan.c +++ b/libavcodec/xxan.c @@ -289,7 +289,8 @@ static int xan_decode_frame_type0(AVCodecContext *avctx) ybuf[j+1] = cur << 1; last = cur; } - ybuf[j] = last << 1; + if(j < avctx->width) + ybuf[j] = last << 1; prev_buf = ybuf; ybuf += avctx->width; }