[FFmpeg-cvslog] pictordec: fix cga palette index limit

Michael Niedermayer git at videolan.org
Sun Feb 10 19:04:15 CET 2013


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Feb 10 18:31:05 2013 +0100| [478fc7f57bac966fcd916419336b349028c549ec] | committer: Michael Niedermayer

pictordec: fix cga palette index limit

Fixes out of array read

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=478fc7f57bac966fcd916419336b349028c549ec
---

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

diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c
index 7c8f7e9..69d2382 100644
--- a/libavcodec/pictordec.c
+++ b/libavcodec/pictordec.c
@@ -174,7 +174,7 @@ static int decode_frame(AVCodecContext *avctx,
         npal = FFMIN(esize, 16);
         for (i = 0; i < npal; i++) {
             int pal_idx = bytestream2_get_byte(&s->g);
-            palette[i]  = ff_cga_palette[FFMIN(pal_idx, 16)];
+            palette[i]  = ff_cga_palette[FFMIN(pal_idx, 15)];
         }
     } else if (etype == 3) {
         npal = FFMIN(esize, 16);



More information about the ffmpeg-cvslog mailing list