# CVE-2026-42146: CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp

- Severity: Medium 5.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.19%, higher than 8% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-05-04T17:53:23.830Z
- Modified: 2026-10-26T19:10:00.163Z
- Weaknesses: CWE-789
- SSVC (CISA-ADP): exploitation poc, automatable no, technical impact partial
- 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.

(As written by CVE List.)

## Affected

- GreycLab CImg: < c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3

## References

- <https://github.com/GreycLab/CImg/issues/477> (exploit)
- <https://github.com/GreycLab/CImg/security/advisories/GHSA-g54r-qmgx-c6fv>
- <https://github.com/GreycLab/CImg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3>
- <https://github.com/GreycLab/CImg/releases/tag/v.3.7.5>

## Sources

- CVE List: [CVE-2026-42146](https://www.cve.org/CVERecord?id=CVE-2026-42146), CVE Terms of Use, modified 2026-05-06
- NVD: [CVE-2026-42146](https://nvd.nist.gov/vuln/detail/CVE-2026-42146), Public domain, modified 2026-10-26

---

Page: https://cve.day/CVE-2026-42146 · Whole record: https://cve.day/CVE-2026-42146.json · Rebuilt by cve.day 2026-11-25T22:59:20.544Z
