Sophie

Sophie

distrib > Mageia > 9 > armv7hl > media > core-release-src > by-pkgid > e3e9386cae3e0574277705f2a1188536 > files > 2

giflib-5.2.1-7.mga9.src.rpm

--- a/gif2rgb.c
+++ b/gif2rgb.c
@@ -294,6 +294,11 @@
             GifRow = ScreenBuffer[i];
             GifQprintf("\b\b\b\b%-4d", ScreenHeight - i);
             for (j = 0, BufferP = Buffer; j < ScreenWidth; j++) {
+                /* Check if color is within color palete */
+                if (GifRow[j] >= ColorMap->ColorCount)
+                {
+                   GIF_EXIT(GifErrorString(D_GIF_ERR_IMAGE_DEFECT));
+                }
                 ColorMapEntry = &ColorMap->Colors[GifRow[j]];
                 *BufferP++ = ColorMapEntry->Red;
                 *BufferP++ = ColorMapEntry->Green;