CVE-2026-42146
JSON

5.5medium

CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp

Severity
5.5medium CVSS:3.1 by GitHub_M
Exploit likelihood
0.19% (higher than 8% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M

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.

Affected

Product or packageVersionsReported by
GreycLab CImg< c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3CVE List

Classification

CWE-789

SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial.

What each source says

CVE List

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.

NVD (es)

CImg Biblioteca es una biblioteca de C++ para procesamiento de imágenes. Antes del commit c3aacf5, el campo nb_colors leído del encabezado del archivo BMP se utiliza directamente para calcular un tamaño de asignación sin validarlo contra el tamaño restante del archivo. Un archivo BMP manipulado con un valor grande de nb_colors desencadena una condición de falta de memoria, provocando el bloqueo de cualquier aplicación que utilice CImg para cargar archivos BMP no confiables. Este problema ha sido parcheado mediante el commit c3aacf5.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-42146 changed 2026-05-06CVE Terms of Use
NVDCVE-2026-42146 changed 2026-10-26Public domain