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

Michael Niedermayer git at videolan.org
Mon Dec 3 21:14:39 CET 2012


ffmpeg | branch: release/1.0 | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 29 15:56:05 2012 +0100| [74241de7ed501a34e7dfe291eed3339ca7b50755] | 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>
(cherry picked from commit 6abb9a901fca27da14d4fffbb01948288b5da3ba)

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

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

diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index 2a9ebe1..58da789 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;



More information about the ffmpeg-cvslog mailing list