giflib: 5.2.2 -> 6.1.3 (#526490)

This commit is contained in:
dotlambda 2026-06-04 04:44:26 +00:00 committed by GitHub
commit 19ea1b37e3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 23 additions and 45 deletions

View file

@ -1,26 +0,0 @@
From ccbc956432650734c91acb3fc88837f7b81267ff Mon Sep 17 00:00:00 2001
From: "Eric S. Raymond" <esr@thyrsus.com>
Date: Wed, 21 Feb 2024 18:55:00 -0500
Subject: [PATCH] Clean up memory better at end of run (CVE-2021-40633)
---
gif2rgb.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gif2rgb.c b/gif2rgb.c
index d51226d..fc2e683 100644
--- a/gif2rgb.c
+++ b/gif2rgb.c
@@ -517,6 +517,9 @@ static void GIF2RGB(int NumFiles, char *FileName, bool OneFileFlag,
DumpScreen2RGB(OutFileName, OneFileFlag, ColorMap, ScreenBuffer,
GifFile->SWidth, GifFile->SHeight);
+ for (i = 0; i < GifFile->SHeight; i++) {
+ (void)free(ScreenBuffer[i]);
+ }
(void)free(ScreenBuffer);
{
--
2.44.0

View file

@ -1,15 +0,0 @@
diff -up giflib-5.2.2/gif2rgb.c.omv~ giflib-5.2.2/gif2rgb.c
--- giflib-5.2.2/gif2rgb.c.omv~ 2025-04-07 21:44:54.956355983 +0200
+++ giflib-5.2.2/gif2rgb.c 2025-04-07 21:45:29.630769589 +0200
@@ -329,6 +329,11 @@ static void DumpScreen2RGB(char *FileNam
GifRow = ScreenBuffer[i];
GifQprintf("\b\b\b\b%-4d", ScreenHeight - i);
for (j = 0; 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]];
Buffers[0][j] = ColorMapEntry->Red;
Buffers[1][j] = ColorMapEntry->Green;

View file

@ -3,21 +3,30 @@
lib,
fetchurl,
fixDarwinDylibNames,
# for passthru.tests
SDL2_image,
SDL_image,
gdal,
imlib2,
leptonica,
libjxl,
libwebp,
openimageio,
openjdk,
pkgsStatic,
}:
stdenv.mkDerivation (finalAttrs: {
pname = "giflib";
version = "5.2.2";
version = "6.1.3";
src = fetchurl {
url = "mirror://sourceforge/giflib/giflib-${finalAttrs.version}.tar.gz";
hash = "sha256-vn/70FfK3r4qoURUL9kMaDjGoIO16KkEi47jtmsp1fs=";
hash = "sha256-tltmuZ8EJLk1JfmHOG8i/F77naK/ySrUpTIkmq/7qw4=";
};
patches = [
./CVE-2021-40633.patch
./CVE-2025-31344.patch
]
++ lib.optionals stdenv.hostPlatform.isMinGW [
# Build dll libraries.
@ -54,6 +63,16 @@ stdenv.mkDerivation (finalAttrs: {
passthru.tests = {
static = pkgsStatic.giflib;
inherit
SDL2_image
SDL_image
gdal
imlib2
leptonica
libjxl
openimageio
openjdk
;
};
meta = {