From 4595e01fd0937e6205cd2568f0553e2dbd12ca6c Mon Sep 17 00:00:00 2001 From: James Zern Date: Tue, 1 Nov 2016 21:02:54 -0700 Subject: [PATCH] Revert "gifdec,Remap: avoid out of bounds colormap read" This reverts commit f048d38d380ef042bb1b5f3a2e5ecc729a5c826a. the 'len' in Remap refers to the src[] not the colormap; this change breaks valid files BUG=webp:316 Change-Id: I1ed40075c2194df91d345cb6f29619b1f5cc96fc --- examples/gifdec.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/examples/gifdec.c b/examples/gifdec.c index 4d246d5f..d04ed8d9 100644 --- a/examples/gifdec.c +++ b/examples/gifdec.c @@ -87,8 +87,7 @@ static void Remap(const GifFileType* const gif, const uint8_t* const src, const GifColorType* colors; const ColorMapObject* const cmap = gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap; - if (cmap == NULL || cmap->Colors == NULL) return; - if (len > cmap->ColorCount) len = cmap->ColorCount; + if (cmap == NULL) return; colors = cmap->Colors; for (i = 0; i < len; ++i) {