CVE-2026-42144
Integer Overflow in CImg Library Leading to Heap Buffer Overflow
Publication date: 2026-05-04
Last updated on: 2026-05-04
Assigner: GitHub, Inc.
Description
Description
CVSS Scores
EPSS Scores
| Probability: | |
| Percentile: |
Meta Information
Affected Vendors & Products
Helpful Resources
Exploitability
| CWE ID | Description |
|---|---|
| CWE-190 | The product performs a calculation that can produce an integer overflow or wraparound when the logic assumes that the resulting value will always be larger than the original value. This occurs when an integer value is incremented to a value that is too large to store in the associated representation. When this occurs, the value may become a very small or negative number. |
Attack-Flow Graph
AI Powered Q&A
Can you explain this vulnerability to me?
This vulnerability exists in the CImg Library, a C++ library used for image processing. Before a specific patch (commit 4ca26bc), there was an integer overflow in the calculation of image size (width * height * depth) inside the _load_pnm() function. This overflow could bypass the memory allocation guard by causing the size calculation to wrap around, resulting in an undersized buffer allocation. When a specially crafted PNM/PGM/PPM image file with very large dimensions is loaded, this can lead to a heap buffer overflow.
Any application that uses the CImg library to load untrusted image files is vulnerable to this issue.
How can this vulnerability impact me? :
The vulnerability can lead to a heap buffer overflow when processing specially crafted image files. This can cause application crashes or potentially allow an attacker to execute arbitrary code or cause denial of service in applications using the vulnerable CImg library.
Since the CVSS score is 6.1 with a vector indicating local attack with low complexity and requiring user interaction, the impact is significant but requires some conditions to be met.
What immediate steps should I take to mitigate this vulnerability?
To mitigate this vulnerability, update the CImg Library to include the patch applied in commit 4ca26bc which fixes the integer overflow in the _load_pnm() function.
Additionally, avoid loading untrusted PNM/PGM/PPM image files with applications using the vulnerable CImg versions until the patch is applied.