Skip to content
OpenAdvisories
Medium · 5.5 CVE-2026-42146 EUVD-2026-27077

CImg Library: Uncontrolled memory allocation via nb_colors field in _load_bmp

Published May 4, 2026 · Updated May 6, 2026 · 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.

Affected products

VendorProductAffectedFixed
GreycLab CImg < c3aacf5b96ac1e54b7af1957c6737dbf3949f6d3 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 cimg 3.5.2+dfsg-2 —
Debian 13 cimg 3.5.2+dfsg-1+deb13u1 —
Debian 12 cimg No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 cimg No fix yet —
Ubuntu 26.04 LTS cimg No fix yet —
Ubuntu 25.10 cimg No fix yet —
Ubuntu 20.04 LTS cimg No fix yet —
Ubuntu 16.04 LTS cimg No fix yet —
Show 3 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu Pro 24.04 LTS cimg No fix yet —
Ubuntu Pro 22.04 LTS cimg No fix yet —
Ubuntu Pro 18.04 LTS cimg No fix yet —

References