
Cloud Vulnerability DB
A community-led vulnerabilities database
CVE-2026-4985 is an integer overflow vulnerability in the cgif_addframe function of dloebl CGIF, a GIF encoder library written in C. The flaw exists in src/cgif.c at line 521, where the multiplication of width * height (both uint16_t values) is implicitly promoted to a signed int, causing overflow for large dimensions and resulting in incorrect frame comparison logic. All versions from v0.4.0 through v0.5.2 are affected; v0.5.3 includes the fix. It carries a CVSS v3.1 base score of 4.3 (Medium) and a CVSS v4.0 base score of 5.3 (Medium) (VulDB, GitHub Issue).
The root cause is CWE-190 (Integer Overflow or Wraparound): in cgif_addframe, the loop bound pGIF->config.width * pGIF->config.height multiplies two uint16_t operands that are implicitly promoted to signed int before multiplication. For dimensions such as 50000×50000, the product (2,500,000,000) exceeds INT_MAX, producing undefined behavior and a negative result, which causes the pixel-comparison loop to be skipped entirely (GitHub Issue, GitHub PR). The attack requires a remote actor to supply a crafted GIF with oversized dimensions to an application using the cgif library, and the vulnerable code path is only entered when a frame has special flags set (e.g., CGIF_FRAME_ATTR_HAS_SET_TRANS or a local color palette). The fix replaces the unsafe multiplication with a MULU16() macro and changes the loop index type from int to uint32_t (GitHub Commit).
Successful exploitation causes the GIF encoder's frame-comparison optimization to be bypassed, resulting in frames with entirely different content being incorrectly identified as identical and discarded. This leads to frame loss, incomplete animations, or data corruption in the generated GIF output, impairing the correctness of applications that rely on cgif — including image processing services and video-to-GIF conversion tools. The impact is limited to availability and output integrity (no confidentiality breach or code execution); exploitation also requires approximately 2.4 GB of available memory on the target system to allocate the oversized frame data (GitHub Issue).
A proof-of-concept exploit was published in the GitHub issue report, demonstrating that an attacker can craft a GIF with 50000×50000 pixel dimensions to trigger the overflow (GitHub Issue). The EPSS score is approximately 0.04%, indicating a low probability of active exploitation in the near term (Feedly). There is no evidence of in-the-wild exploitation, no known threat actor attribution, and the vulnerability is not listed in the CISA Known Exploited Vulnerabilities catalog. Exploitation requires user interaction (processing a malicious GIF) and significant system memory (>2.4 GB), limiting practical attack scenarios.
CGIF_FRAME_ATTR_HAS_SET_TRANS or a local color palette to trigger the pixel-comparison code path.cgif_addframe().cgif_addframe() processes the second frame, the multiplication width * height (50000 × 50000 = 2,500,000,000) overflows the signed int type, producing a negative loop bound.width * height approaches INT_MAX).Upgrade to cgif v0.5.3 or later, which includes the fix merged on March 30, 2026 (commit b0ba830) that replaces the unsafe width * height multiplication with the MULU16() macro and changes the loop index to uint32_t (GitHub Commit, GitHub Repo). Fedora users can apply the updated libcgif package available via the Fedora security advisory (Linux Security). As a workaround where patching is not immediately possible, applications should validate and reject GIF inputs with dimensions whose product exceeds INT_MAX (i.e., width × height > 2,147,483,647) before passing them to the cgif library.
The vulnerability was reported by researcher lanlanzzx via a GitHub issue on March 11, 2026, and the maintainer (dloebl) confirmed the issue and merged a fix on March 30, 2026 (GitHub Issue, GitHub PR). A blog post on jericho.blog (March 31, 2026) referenced the CVE in the context of CNA rule discussions. Fedora issued a security advisory for the updated libcgif package, and German Linux security outlet pro-linux.de covered the integer overflow fix in libcgif across multiple updates.
Fix availability across major Linux distributions and their releases.
Source: This report was generated using AI
Free Vulnerability Assessment
Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.
Get a personalized demo
"Best User Experience I have ever seen, provides full visibility to cloud workloads."
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
"We know that if Wiz identifies something as critical, it actually is."