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

Published May 4, 2026
·
Updated

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.

Affected Software

1 affected component
CImg CImg Library<c3aacf5

Event History

May 4, 2026
CVE Published
via MITRE·05:53 PM
Data Sourced
via MITRE·05:53 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·06:16 PM
DescriptionSeverityWeakness
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-42146?

CVE-2026-42146 has been classified as a high severity vulnerability due to its potential to lead to uncontrolled memory allocation.

2

How do I fix CVE-2026-42146?

To resolve CVE-2026-42146, update the CImg Library to a version after commit c3aacf5, which contains the necessary fixes.

3

What type of vulnerability is CVE-2026-42146?

CVE-2026-42146 is categorized as a memory allocation vulnerability that allows for unchecked allocation based on the nb_colors field.

4

In which versions of the CImg Library is CVE-2026-42146 present?

CVE-2026-42146 affects all versions of the CImg Library prior to c3aacf5.

5

What software is affected by CVE-2026-42146?

CVE-2026-42146 impacts the CImg Library used for image processing.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203