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
This commit is contained in:
James Zern 2016-11-01 21:02:54 -07:00
parent fb52d4432a
commit 4595e01fd0

View File

@ -87,8 +87,7 @@ static void Remap(const GifFileType* const gif, const uint8_t* const src,
const GifColorType* colors; const GifColorType* colors;
const ColorMapObject* const cmap = const ColorMapObject* const cmap =
gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap; gif->Image.ColorMap ? gif->Image.ColorMap : gif->SColorMap;
if (cmap == NULL || cmap->Colors == NULL) return; if (cmap == NULL) return;
if (len > cmap->ColorCount) len = cmap->ColorCount;
colors = cmap->Colors; colors = cmap->Colors;
for (i = 0; i < len; ++i) { for (i = 0; i < len; ++i) {