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.
Published: 2026-05-04
Score: 5.5 Medium
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

CImg Library contains a flaw in the _load_bmp function where the nb_colors field extracted from a BMP file header is used directly to calculate an allocation size without checking it against the file size. Providing a BMP with a very large nb_colors value causes the program to allocate an excessively large buffer, leading to an out‑of‑memory condition and a crash of any application that loads such a file. The vulnerability is classified as CWE‑789, representing an uncontrolled memory allocation.

Affected Systems

Any installation of the CImg Library that predates commit c3aacf5 (prior to the v3.7.5 release) is affected. Applications that use this library to load BMP images from untrusted sources will be vulnerable if they rely on the unpatched version. The patch is available in the v3.7.5 release and in the mentioned Git commit.

Risk and Exploitability

The CVSS score of 5.5 indicates medium severity. No EPSS score is reported, and the vulnerability is not listed in CISA’s KEV catalog, suggesting it has not yet been widely exploited in the wild. Based on the description, it is inferred that attackers would need to supply a crafted BMP file that an application parses with CImg. If the application processes user‑supplied BMP images, the vulnerability could be leveraged remotely; otherwise, it remains a local denial of service risk. The most likely attack vector is delivering a malicious BMP file to the vulnerable application. The lack of a public exploit mitigates immediate threat, but the potential for application crashes warrants prompt remediation.

Generated by OpenCVE AI on May 4, 2026 at 19:50 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade CImg to version 3.7.5 or apply the patch commit c3aacf5 to fix the unvalidated allocation.
  • If upgrading is not immediately possible, block or validate BMP files before passing them to CImg, ensuring the nb_colors value does not exceed a safe limit or that the file size is sufficient for the claimed allocation.
  • Disable or restrict BMP loading in applications that do not require this image format until a secure version is deployed.

Generated by OpenCVE AI on May 4, 2026 at 19:50 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Mon, 04 May 2026 20:15:00 +0000

Type Values Removed Values Added
First Time appeared Greyclab
Greyclab cimg
Vendors & Products Greyclab
Greyclab cimg

Mon, 04 May 2026 18:15:00 +0000

Type Values Removed Values Added
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.
Title CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp
Weaknesses CWE-789
References
Metrics cvssV3_1

{'score': 5.5, 'vector': 'CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-05-04T17:53:23.830Z

Reserved: 2026-04-24T17:15:21.834Z

Link: CVE-2026-42146

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-05-04T18:16:31.977

Modified: 2026-05-04T18:16:31.977

Link: CVE-2026-42146

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-05-04T20:00:07Z

Weaknesses