Medium severity · published May 4, 2026
CVE-2026-42146
CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
5.5
CVSS
0.2%
EPSS
No
On KEV
Description
CImg Library is a C++ library for image processing. Prior to commit c3aacf5, the nb_colors field read from the BMP file header is used directly to compute an allocation size without validating it against the remaining file size. A crafted BMP file with a large nb_colors value triggers an out-of-memory condition, crashing any application that uses CImg to load untrusted BMP files. This issue has been patched via commit c3aacf5.
CVSS vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H
Attack vector
Local
Complexity
Low
Privileges
None
User interaction
Required
Confidentiality
None
Integrity
None
Availability
High
Scope
Unchanged
Exploitation
Is it being used?
Exploit prediction (EPSS)0.2% · higher than 8% of CVEs
Exploited in the wildNo evidence yet
CISA KEVNot listed
Ransomware campaign useNot known
Affected products
Which versions
CI
CImg · GreycLab
< c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3 · source: vendor
References
NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-42146
CVE.org
https://www.cve.org/CVERecord?id=CVE-2026-42146
github.com
https://github.com/GreycLab/CImg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3
github.com
https://github.com/GreycLab/CImg/issues/477
github.com
https://github.com/GreycLab/CImg/releases/tag/v.3.7.5
github.com
https://github.com/GreycLab/CImg/security/advisories/GHSA-g54r-qmgx-c6fv
More from CImg
7.5
CVE-2026-47667
CImg Library: Uncontrolled Memory Allocation and Memory Leak in `_load_analyze()` via Crafted NIfTI/Analyze Header
6.1
CVE-2026-117555
GreycLab CImg through 4.0.6 Heap Out-of-Bounds Read via Integer Overflow in _load_bmp()
6.1
CVE-2026-42144
CImg Library: Integer overflow in PNM size check bypasses memory guard (_load_pnm)
