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

Michael Niedermayer git at videolan.org
Fri Nov 28 20:28:47 CET 2014


ffmpeg | branch: release/0.5 | Michael Niedermayer <michaelni at gmx.at> | Thu Nov 29 15:56:05 2012 +0100| [e74795e54108e6540adf180a5bd4f59023cd16a4] | 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)

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

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

diff --git a/libavcodec/huffyuv.c b/libavcodec/huffyuv.c
index aad9168..72dd52e 100644
--- a/libavcodec/huffyuv.c
+++ b/libavcodec/huffyuv.c
@@ -555,7 +555,10 @@ s->bgr32=1;
     default:
         assert(0);
     }
-
+    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);
 
 //    av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);



More information about the ffmpeg-cvslog mailing list