File giflib-CVE-2022-28506.patch of Package giflib.38145

--- giflib-5.0.5/util/gif2rgb.c	2024-07-23 08:33:42.771452333 +0200
+++ giflib-5.0.5/util/gif2rgb.c	2024-07-23 08:40:07.380834804 +0200
@@ -298,6 +298,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;
openSUSE Build Service is sponsored by