fix CVE-2026-26740: buffer overflow in EGifGCBToExtension (RHEL-154865)

Resolves: RHEL-154865
This commit is contained in:
Michal Hlavinka 2026-06-08 12:09:39 +02:00
parent 833c4ccf48
commit f9c2aaad9d
2 changed files with 20 additions and 1 deletions

View File

@ -0,0 +1,13 @@
diff --git a/egif_lib.c b/egif_lib.c
index 6219af0..5fb458f 100644
--- a/egif_lib.c
+++ b/egif_lib.c
@@ -689,6 +689,8 @@ int EGifGCBToSavedExtension(const GraphicsControlBlock *GCB,
for (i = 0; i < GifFile->SavedImages[ImageIndex].ExtensionBlockCount; i++) {
ExtensionBlock *ep = &GifFile->SavedImages[ImageIndex].ExtensionBlocks[i];
if (ep->Function == GRAPHICS_EXT_FUNC_CODE) {
+ if (ep->ByteCount != 4)
+ return GIF_ERROR;
EGifGCBToExtension(GCB, ep->Bytes);
return GIF_OK;
}

View File

@ -1,7 +1,7 @@
Name: giflib
Summary: A library and utilities for processing GIFs
Version: 5.2.1
Release: 10%{?dist}
Release: 11%{?dist}
License: MIT
URL: http://www.sourceforge.net/projects/%{name}/
@ -15,6 +15,9 @@ Patch2: giflib_html-docs-consistent-ids.patch
# from upstream, for <= 6.1.1, RHEL-154864
# https://sourceforge.net/p/giflib/code/ci/f5b7267aed3665ef025c13823e454170d031c106/
Patch3: giflib-5.2.1-cve-2026-23868.patch
# sent upstream, RHEL-154865
# https://sourceforge.net/p/giflib/bugs/199/
Patch4: giflib-5.2.1-cve-2026-26740.patch
BuildRequires: gcc
BuildRequires: make
@ -80,6 +83,9 @@ rm -f %{buildroot}%{_libdir}/libgif.a
%changelog
* Mon Jun 08 2026 Michal Hlavinka <mhlavink@redhat.com> - 5.2.1-11
- fix CVE-2026-26740: buffer overflow in EGifGCBToExtension (RHEL-154865)
* Tue Mar 24 2026 Michal Hlavinka <mhlavink@redhat.com> - 5.2.1-10
- fix CVE-2026-23868: double free in GifMakeSavedImage (RHEL-154864)