[FFmpeg-cvslog] lagarith: always allocate for 4 planes. Fixes out of array accesses

Michael Niedermayer git at videolan.org
Mon Nov 12 18:12:40 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Nov 12 17:35:01 2012 +0100| [9eef41b848939a0a86582afdb45235e41612d9ba] | committer: Michael Niedermayer

lagarith: always allocate for 4 planes. Fixes 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=9eef41b848939a0a86582afdb45235e41612d9ba
---

 libavcodec/lagarith.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/lagarith.c b/libavcodec/lagarith.c
index 0611abf..d0a5049 100644
--- a/libavcodec/lagarith.c
+++ b/libavcodec/lagarith.c
@@ -569,7 +569,7 @@ static int lag_decode_frame(AVCodecContext *avctx,
 
         if (!l->rgb_planes) {
             l->rgb_stride = FFALIGN(avctx->width, 16);
-            l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * planes + 16);
+            l->rgb_planes = av_malloc(l->rgb_stride * avctx->height * 4 + 16);
             if (!l->rgb_planes) {
                 av_log(avctx, AV_LOG_ERROR, "cannot allocate temporary buffer\n");
                 return AVERROR(ENOMEM);



More information about the ffmpeg-cvslog mailing list