From 478fc7f57bac966fcd916419336b349028c549ec Mon Sep 17 00:00:00 2001 From: Michael Niedermayer Date: Sun, 10 Feb 2013 18:31:05 +0100 Subject: [PATCH] pictordec: fix cga palette index limit Fixes out of array read Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer --- libavcodec/pictordec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pictordec.c b/libavcodec/pictordec.c index 7c8f7e9f36..69d23828b3 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);