Integer Overflow or Wraparound Affecting cimg package, versions <4.0.5-r0


Severity

Recommended
low

Based on default assessment until relevant scores are available.

Threat Intelligence

EPSS
0.15% (5th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-CHAINGUARDLATEST-CIMG-20360521
  • published1 Oct 2026
  • disclosed4 May 2026

Introduced: 4 May 2026

CVE-2026-42144  (opens in a new tab)
CWE-190  (opens in a new tab)

How to fix?

Upgrade Chainguard cimg to version 4.0.5-r0 or higher.

NVD Description

Note: Versions mentioned in the description apply only to the upstream cimg package and not the cimg package as distributed by Chainguard. See How to fix? for Chainguard relevant fixed versions and status.

CImg Library is a C++ library for image processing. Prior to commit 4ca26bc, there is an integer overflow vulnerability in the WHD size computation inside _load_pnm() that can bypass the memory allocation guard. A crafted PNM/PGM/PPM file with large dimension values causes the overflow to wrap around, allocating an undersized buffer and potentially triggering a heap buffer overflow. Any application using CImg to load untrusted image files is affected. This issue has been patched via commit 4ca26bc.