CImg Library is a C++ library for image processing. Prior to commit c3aacf5, the nbcolors 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 nbcolors 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.
{
"cwe_ids": [
"CWE-789"
],
"osv_generated_from": "https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42146.json",
"cna_assigner": "GitHub_M",
"unresolved_ranges": [
{
"extracted_events": [
{
"fixed": "c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3"
}
],
"source": "AFFECTED_FIELD"
}
]
}[
{
"source": "https://github.com/greyclab/cimg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3",
"signature_version": "v1",
"signature_type": "Line",
"digest": {
"line_hashes": [
"318172894725783406681287929515958403779",
"150621348207869847369843225262995890926",
"131616633530240992493435991106862578432",
"210207947198146663960019255917778880673"
],
"threshold": 0.9
},
"deprecated": false,
"id": "CVE-2026-42146-f25f270d",
"target": {
"file": "CImg.h"
}
}
]
"2026-07-15T23:27:40Z"
"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-42146.json"