xxan: more complete ybuf checks, fix out of array accesses.

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Michael Niedermayer 2012-12-01 23:20:48 +01:00
parent 196920060b
commit 77693c541a

View File

@ -276,7 +276,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;
@ -350,7 +351,8 @@ static int xan_decode_frame_type1(AVCodecContext *avctx)
ybuf[j+1] = cur;
last = cur;
}
ybuf[j] = last;
if(j < avctx->width)
ybuf[j] = last;
ybuf += avctx->width;
}