xl: Fix overreads

Signed-off-by: Martin Storsjö <martin@martin.st>
(cherry picked from commit 00aad121d8)

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
Aneesh Dogra 2011-12-20 00:00:30 +05:30 committed by Michael Niedermayer
parent c0c5189e66
commit 2cdd89a561
1 changed files with 6 additions and 0 deletions

View File

@ -68,6 +68,12 @@ static int decode_frame(AVCodecContext *avctx,
V = a->pic.data[2]; V = a->pic.data[2];
stride = avctx->width - 4; stride = avctx->width - 4;
if (buf_size < avctx->width * avctx->height) {
av_log(avctx, AV_LOG_ERROR, "Packet is too small\n");
return AVERROR_INVALIDDATA;
}
for (i = 0; i < avctx->height; i++) { for (i = 0; i < avctx->height; i++) {
/* lines are stored in reversed order */ /* lines are stored in reversed order */
buf += stride; buf += stride;