[FFmpeg-cvslog] huffyuvdec: check width more completely, avoid out of array accesses

Michael Niedermayer git at videolan.org
Thu Nov 29 16:04:40 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 29 15:56:05 2012 +0100| [6abb9a901fca27da14d4fffbb01948288b5da3ba] | committer: Michael Niedermayer

huffyuvdec: check width more completely, avoid out of array accesses

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6abb9a901fca27da14d4fffbb01948288b5da3ba
---

 libavcodec/huffyuv.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 6e88114..ca5bcd8 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 == AV_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;



More information about the ffmpeg-cvslog mailing list