8000 giflib: 5.2.2 -> 6.1.3 + CVE-2026-26740 backport by bryan-minimal · Pull Request #914 · gominimal/pkgs · GitHub
[go: up one dir, main page]

Skip to content

giflib: 5.2.2 -> 6.1.3 + CVE-2026-26740 backport - #914

Merged
bryan-minimal merged 1 commit into
mainfrom
giflib-cve-fixes
Oct 20, 2026
Merged

bryan-minimal merged 1 commit into
mainfrom
giflib-cve-fixes

Conversation

@bryan-minimal
@bryan-minimal bryan-minimal commented Oct 17, 2026 •
Copy link
Copy Markdown
Member

Bumps giflib 5.2.2 → 6.1.3 and backports the unreleased upstream fix for CVE-2026-26740. Found by minimal-supply-chain#519. pkgmgr vulns --package giflib showed three open advisories against 5.2.2.

CVEs

CVE Severity Where Fix here
CVE-2026-23868 MEDIUM double-free from a shallow copy in GifMakeSavedImage (libgif) Bump. Fixed upstream in f5b7267 and shipped in 6.1.2 (NVD lists it as fixed in 6.1.1). 6.1.3 includes it.
CVE-2026-26740 HIGH EGifGCBToSavedExtension writes 4 bytes into an existing GCE block without checking ByteCount (libgif) Backport. 6.1.3 is still vulnerable: the code is unchanged in that release. The fix is upstream commit 0616050 (giflib master, 2026-06-01), which hasn't been released yet. It ships as 0001-CVE-2026-26740-egif-gcb-bounds-check.patch (git format-patch of that commit), applied with patch -Np1 under set -ex so a failed hunk fails the build. Remove it once a giflib release includes it.
CVE-2024-45993 MEDIUM heap overflow in the gif2rgb CLI tool Not shipped by this package. The recipe has always built only libgif.so and libgif.a, never the utilities. NVD's CPE pins exactly 5.2.2, so the bump clears the scanner row. Upstream also moved gif2rgb to "obsolete" in 6.1.1.

NVD's CPE for CVE-2026-26740 names only 5.2.2. Without the patch, the scanner would report 6.1.3 as clean while the library was still vulnerable.

Bump vs backport

  • The soname stays libgif.so.7 (LIBMAJOR=7 in the 6.1.3 Makefile, -Wl,-soname -Wl,libgif.so.7 in the build log). The outputs globs are unchanged.
  • The only API change in 6.x: EGifSpew() gained an int *ErrorCode parameter, and the E_GIF_ERR_* codes were renumbered (201+). gif_lib.h has no other changes.
  • OpenJDK is the only consumer. Its splashscreen (libsplashscreen/splashscreen_gif.c) only decodes, using DGifOpen, DGifSlurp and DGifCloseFile. It already handles major version 6 through #if GIFLIB_MAJOR > 5 || (...), which selects the two-argument DGifCloseFile. I checked this at jdk-9+181, jdk-10+46, jdk-12+33 and jdk25u.

Consumer impact

The importers of ../giflib/build.ncl are openjdk-9 through openjdk-25, all built with --with-giflib=system. icedtea-7 and icedtea-8 pass --disable-system-gif and don't import giflib. This change rebuilds every openjdk rung (9..25).

Tests

  • decode_like_openjdk: decodes a 1x1 GIF89a from memory the way OpenJDK does (DGifOpen with a read callback, DGifSlurp, DGifSavedExtensionToGCB, two-argument DGifCloseFile). It also asserts at compile time that the header is ≥ 6.1.2, the first release with the CVE-2026-23868 fix.
  • gcb_to_short_extension_rejected: regression test for CVE-2026-26740. It gives a saved image a 2-byte GCE block and requires EGifGCBToSavedExtension to return GIF_ERROR and leave the block untouched. Negative control: I rebuilt with the patch line disabled. This test failed and decode_like_openjdk still passed.

Verification

  • min package build --rebuild --verbose giflib (arm64 min session): built, patch applied (patching file egif_lib.c).
  • min check --packages giflib: all checks pass, including standalone tests.
  • min package build --rebuild --verbose openjdk-9 (cheapest consumer: boots from the cached icedtea-8, which does not import giflib) + min check --packages openjdk-9: build finished, all checks Pass. The session log was nearly silent, so the authoritative consumer evidence is this PR's CI build of the openjdk rungs.

Notes

  • I uploaded the source tarball to gs://minimal-staging-archives/giflib-6.1.3.tar.gz. It is the upstream SourceForge tarball, and its sha256 b65b66b9…ab0e matches both the upstream download and the copy in the mirror.
  • Upstream master also has two library fixes past 6.1.3 that have no CVE: 4a731ea (integer overflow and type fixes) and 8abe475 (Simplify GHC packaging by extracting bootstrap and build tools #203 GifUnionColorMap NULL dereference). I didn't backport them, to keep this change limited to the CVEs.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes

    • Malformed GIF graphics-control blocks that are shorter than expected are now rejected safely, without altering their data.
    • GIF decoding and graphics-control data handling are covered by additional checks.
  • Updates

    • Updated the GIF library to version 6.1.3, improving compatibility with newer GIF files and preserving expected image, color, and animation-delay information during decoding.

6.1.2 fixes CVE-2026-23868 (GifMakeSavedImage double-free). 6.1.3 still
carries CVE-2026-26740 (EGifGCBToSavedExtension heap OOB write); the fix
(upstream 0616050) is on giflib master but unreleased, so it rides as a
fail-closed patch. CVE-2024-45993 is in gif2rgb, which this recipe never
built; 6.1.1 also moved gif2rgb to obsolete.

soname stays libgif.so.7. The only API change is EGifSpew's new
ErrorCode param; OpenJDK's splashscreen only decodes and already takes
the GIFLIB_MAJOR > 5 branch in every rung (9..25).

Tests: an OpenJDK-style in-memory decode with a version pin, and a
CVE-2026-26740 regression that fails without the patch.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@bryan-minimal
bryan-minimal requested a review from a team as a code owner October 17, 2026 18:50
@coderabbitai
coderabbitai Bot commented Oct 17, 2026 •
Copy link
Copy Markdown
Contributor

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Repository: gominimal/pkgs/.coderabbit.yaml
  • Review profile: CHILL
  • Plan: Essentials
  • Run ID: bf82d1bc-0eb5-464d-b435-fcd96c9641a8
📥 Commits

Reviewing files that changed from the base of the PR and between 5a26fc2 and 681309f.

📒 Files selected for processing: 3
  • packages/giflib/0001-CVE-2026-26740-egif-gcb-bounds-check.patch
  • packages/giflib/build.ncl
  • packages/giflib/build.sh

Included review availability: This review used your included allowance. 0 included reviews remain after this review. Your included PR review attempts over the past 7 days set your current allowance at 2 reviews per hour.

📝 Walkthrough

The giflib package advances to version 6.1.3 and applies a patch that rejects graphics-control extension blocks shorter than four bytes. Standalone tests check GIF decoding and confirm that the rejection leaves a short extension unchanged.

Changes: giflib package update

Layer / File(s) Summary
Version update and bounds-check patch
packages/giflib/0001-CVE-2026-26740-egif-gcb-bounds-check.patch, packages/giflib/build.ncl, packages/giflib/build.sh
The package updates giflib to 6.1.3 and applies a patch that returns GIF_ERROR for graphics-control extension blocks shorter than four bytes. The build script applies the patch and updates its comment about utility CVEs.
Decode and short-block tests
packages/giflib/build.ncl
Standalone tests check decoding a 1×1 GIF, including image, color, and graphics-control data. A regression test checks that a two-byte extension returns GIF_ERROR without changing its bytes.

Priority: ⬆️ High

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Bug fix

Suggested reviewers: 0chroma

Merge Risk: ⚪ Minimal · up to 68130

This updates giflib to 6.1.3 and backports a bounds check that rejects short graphics-control extension blocks. No merge-blocking risk was found; the OpenJDK rebuild results should be confirmed in CI.

Pre-merge checks: Passed 5
Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title clearly and concisely identifies the primary changes: the giflib version update and the CVE-2026-26740 backport.
Docstring Coverage Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Docstring Coverage

Explanation

No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 1 files. (2 skipped: 2 unsupported.)

✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Comment @coderabbitai help to get the list of available commands.

@norrietaylor norrietaylor left a comment
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

  • The sha256 matches the SourceForge 6.1.3 tarball.
  • The hunk matches upstream 061605081115 and applies to 6.1.3.
  • The soname stays libgif.so.7, so the globs hold.
  • The only dependents (openjdk-9…25) are decoders, so the EGifSpew() ABI change doesn't affect them.

Nit, build.ncl:84: the version guard GIFLIB_MAJOR == 6 && (GIFLIB_MINOR > 1 || GIFLIB_RELEASE >= 2) also accepts 6.0.2–6.0.x. It should be (GIFLIB_MINOR > 1 || (GIFLIB_MINOR == 1 && GIFLIB_RELEASE >= 2)). It doesn't affect this build.


Generated by Claude Code

@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to failed status checks Oct 19, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 19, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to no response for status checks Oct 19, 2026
@bryan-minimal
bryan-minimal added this pull request to the merge queue Oct 20, 2026
Merged via the queue into main with commit 2366c9d Oct 20, 2026
11 checks passed
@bryan-minimal
bryan-minimal deleted the giflib-cve-fixes branch October 20, 2026 00:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

0