CVE-2026-42146: CWE-789: Memory Allocation with Excessive Size Value in GreycLab CImg
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.
AI Analysis
Technical Summary
The vulnerability CVE-2026-42146 in GreycLab's CImg library involves a lack of validation on the nb_colors field read from BMP file headers. This field is used to compute memory allocation size without checking if it exceeds the remaining file size, leading to excessive memory allocation attempts. When a malicious BMP file specifies a large nb_colors value, it can trigger an out-of-memory condition causing the application to crash. This is classified under CWE-789 (Memory Allocation with Excessive Size Value). The vulnerability affects all versions before commit c3aacf5 and has been fixed by adding proper validation in that commit.
Potential Impact
Exploitation of this vulnerability results in an out-of-memory condition that crashes applications using vulnerable versions of CImg to load crafted BMP files. There is no indication of confidentiality or integrity impact, only availability is affected due to application crashes. No known exploits have been reported in the wild.
Mitigation Recommendations
This vulnerability has been patched in commit c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3 of the CImg library. Users should upgrade to this version or later to remediate the issue. Since this is not a cloud service, remediation requires updating the library in affected applications. Patch status is confirmed by the referenced commit. No additional mitigation steps are indicated by the vendor.
CVE-2026-42146: CWE-789: Memory Allocation with Excessive Size Value in GreycLab CImg
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.
CVSS v3.1
Score 5.5medium
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability CVE-2026-42146 in GreycLab's CImg library involves a lack of validation on the nb_colors field read from BMP file headers. This field is used to compute memory allocation size without checking if it exceeds the remaining file size, leading to excessive memory allocation attempts. When a malicious BMP file specifies a large nb_colors value, it can trigger an out-of-memory condition causing the application to crash. This is classified under CWE-789 (Memory Allocation with Excessive Size Value). The vulnerability affects all versions before commit c3aacf5 and has been fixed by adding proper validation in that commit.
Potential Impact
Exploitation of this vulnerability results in an out-of-memory condition that crashes applications using vulnerable versions of CImg to load crafted BMP files. There is no indication of confidentiality or integrity impact, only availability is affected due to application crashes. No known exploits have been reported in the wild.
Mitigation Recommendations
This vulnerability has been patched in commit c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3 of the CImg library. Users should upgrade to this version or later to remediate the issue. Since this is not a cloud service, remediation requires updating the library in affected applications. Patch status is confirmed by the referenced commit. No additional mitigation steps are indicated by the vendor.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-04-24T17:15:21.834Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 69f8e3e0cbff5d86103e4669
Added to database: 5/4/2026, 6:22:24 PM
Last enriched: 5/12/2026, 6:18:25 AM
Last updated: 6/18/2026, 11:40:45 AM
Views: 66
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.