aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-11-29 15:56:05 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-12-03 21:03:14 +0100
commit74241de7ed501a34e7dfe291eed3339ca7b50755 (patch)
tree79263a35bb05f8fd0225bf1ced31a4afda661e06
parent38e8f78c041bd28f5b8d32f2fd945eae8ce28598 (diff)
downloadffmpeg-74241de7ed501a34e7dfe291eed3339ca7b50755.tar.gz
huffyuvdec: check width more completely, avoid out of array accesses
Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michaelni@gmx.at> (cherry picked from commit 6abb9a901fca27da14d4fffbb01948288b5da3ba)
-rw-r--r--libavcodec/huffyuv.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 2a9ebe1b2c..58da7894e4 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -514,7 +514,10 @@ static av_cold int decode_init(AVCodecContext *avctx)
av_log(avctx, AV_LOG_ERROR, "width must be even for this colorspace\n");
return AVERROR_INVALIDDATA;
}
-
+ if (s->predictor == MEDIAN && avctx->pix_fmt == PIX_FMT_YUV422P && avctx->width%4) {
+ av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 this colorspace and predictor\n");
+ return AVERROR_INVALIDDATA;
+ }
alloc_temp(s);
return 0;