{"id":"CVE-2026-42146","summary":"CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp","details":"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.","aliases":["GHSA-g54r-qmgx-c6fv"],"modified":"2026-07-15T23:27:40.780191Z","published":"2026-05-04T17:53:23.830Z","database_specific":{"cna_assigner":"GitHub_M","cwe_ids":["CWE-789"],"osv_generated_from":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42146.json","unresolved_ranges":[{"extracted_events":[{"fixed":"c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3"}],"source":"AFFECTED_FIELD"}]},"references":[{"type":"WEB","url":"https://github.com/GreycLab/CImg/releases/tag/v.3.7.5"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/42xxx/CVE-2026-42146.json"},{"type":"ADVISORY","url":"https://github.com/GreycLab/CImg/security/advisories/GHSA-g54r-qmgx-c6fv"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-42146"},{"type":"REPORT","url":"https://github.com/GreycLab/CImg/issues/477"},{"type":"FIX","url":"https://github.com/GreycLab/CImg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3"}],"affected":[{"ranges":[{"type":"GIT","repo":"https://github.com/greyclab/cimg","events":[{"introduced":"0"},{"fixed":"c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3"},{"fixed":"63ad0902bc0b3b3e82e30d8ac3e5135937bac0c0"}],"database_specific":{"source":"REFERENCES"}}],"versions":["v.3.7.4","v.3.7.3","v.3.7.2","v.3.7.1","v.3.7.0","v.3.6.6","v.3.6.5","v.3.6.4","v.3.6.3","v.3.6.2","v.3.6.1","v.3.6.0","v.3.5.5","v.3.5.4","v.3.5.3","v.3.5.2","v.3.5.1","v.3.5.0","v.3.4.3","v.3.4.2","v.3.4.1","v.3.4.0","v.3.3.6","v.3.3.5","v.3.3.4","v.3.3.3","v.3.3.2","v.3.3.1","v.3.3.0","v.3.2.6","v.3.2.5","v.3.2.4","v.3.2.3","v.3.2.2","v.3.2.1","v.3.2.0","v.3.1.6","v.3.1.4","v.3.1.3","v.3.1.2","v.3.1.1","v.3.1.0","v.2.9.0","v.2.8.4","v.2.8.3","v.2.8.2","v.2.8.1","v.2.8.0","v.2.7.5","v.2.7.4","v.2.7.3","v.2.7.2","v.2.7.1","v.2.7.0","v.2.6.7","v.2.6.6","v.2.6.5","v.2.6.4","v.2.6.3","v.2.6.2","v.2.6.1","v.2.6.0","v.2.5.7","v.2.5.6","v.2.5.5","v.2.5.4","v.2.5.3","v.2.5.2","v.2.5.1","v.2.5.0","v.2.4.5","v.2.4.4","v.2.4.3","v.2.4.2","v.2.4.1","v.2.4.0","v.2.3.6","v.2.3.5","v.2.3.4","v.2.3.3","v.2.3.2","v.2.3.1","v.2.3.0"],"database_specific":{"source":"https://storage.googleapis.com/cve-osv-conversion/osv-output/CVE-2026-42146.json","vanir_signatures_modified":"2026-07-15T23:27:40Z","vanir_signatures":[{"target":{"file":"CImg.h"},"deprecated":false,"digest":{"line_hashes":["318172894725783406681287929515958403779","150621348207869847369843225262995890926","131616633530240992493435991106862578432","210207947198146663960019255917778880673"],"threshold":0.9},"id":"CVE-2026-42146-f25f270d","signature_type":"Line","signature_version":"v1","source":"https://github.com/greyclab/cimg/commit/c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3"}]}}],"schema_version":"1.7.5","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"}]}