Skip to content
Heist/ feed
Back to feed
Medium

cimg — security advisory

Type: advisorySources: OSVAdvisory ID: UBUNTU-CVE-2026-42146

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.

Products
cimg
Affected versions
1.6.4+dfsg-1build1, 1.6.5+dfsg-1, 1.7.9+dfsg-2, 1.7.9+dfsg-2build1, 1.7.9+dfsg-2ubuntu0.18.04.1, 1.7.9+dfsg-2ubuntu0.18.04.2, 1.7.9+dfsg-2ubuntu0.18.04.2+esm1, 2.4.5+dfsg-1, 2.9.4+dfsg-2, 2.9.4+dfsg-3, 2.9.4+dfsg-3ubuntu0.1~esm1, 3.2.1+dfsg-1, 3.2.1+dfsg-1ubuntu0.24.04.1~esm1, 3.5.2+dfsg-1, 3.5.2+dfsg-1build1, 3.5.2+dfsg-2
Fixed versions
Not specified
CVEs
CVE-2026-42146
Confirmed fixed CVEs
Not specified
Updated in this feed
31 Oct 2026, 02:44 UTC · Revision 1

Source evidence

UBUNTU-CVE-2026-42146

core-osv · Original source

Published 4 May 2026, 18:16 UTC

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.

osv:UBUNTU-CVE-2026-42146

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

cimg

Fixed versions: Not specified

Complete source record
{
  "id": "5b1de2c77da88b857d0d0f13a260a7fd929ee476148119f97c2ec86963b6fc51",
  "url": "https://osv.dev/vulnerability/UBUNTU-CVE-2026-42146",
  "method": "structured",
  "payload": {
    "kind": "advisory",
    "title": "UBUNTU-CVE-2026-42146",
    "summary": "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.",
    "evidence": "osv:UBUNTU-CVE-2026-42146",
    "products": [
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/0/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "1.6.4+dfsg-1build1",
            "evidence": "/affected/0/versions"
          },
          {
            "value": "1.6.5+dfsg-1",
            "evidence": "/affected/0/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/1/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "1.7.9+dfsg-2",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.7.9+dfsg-2build1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.7.9+dfsg-2ubuntu0.18.04.1",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.7.9+dfsg-2ubuntu0.18.04.2",
            "evidence": "/affected/1/versions"
          },
          {
            "value": "1.7.9+dfsg-2ubuntu0.18.04.2+esm1",
            "evidence": "/affected/1/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/2/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "2.4.5+dfsg-1",
            "evidence": "/affected/2/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/3/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "2.9.4+dfsg-2",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "2.9.4+dfsg-3",
            "evidence": "/affected/3/versions"
          },
          {
            "value": "2.9.4+dfsg-3ubuntu0.1~esm1",
            "evidence": "/affected/3/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/4/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "3.2.1+dfsg-1",
            "evidence": "/affected/4/versions"
          },
          {
            "value": "3.2.1+dfsg-1ubuntu0.24.04.1~esm1",
            "evidence": "/affected/4/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/5/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "3.5.2+dfsg-1",
            "evidence": "/affected/5/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/6/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "3.5.2+dfsg-1build1",
            "evidence": "/affected/6/versions"
          },
          {
            "value": "3.5.2+dfsg-2",
            "evidence": "/affected/6/versions"
          }
        ]
      },
      {
        "name": {
          "value": "cimg",
          "evidence": "/affected/7/package/name"
        },
        "prerequisites": [],
        "fixed_versions": [],
        "affected_versions": [
          {
            "value": "3.5.2+dfsg-1",
            "evidence": "/affected/7/versions"
          },
          {
            "value": "3.5.2+dfsg-1build1",
            "evidence": "/affected/7/versions"
          }
        ]
      }
    ],
    "severity": "medium",
    "structured": {
      "id": "UBUNTU-CVE-2026-42146",
      "aliases": [
        "UBUNTU-CVE-2026-42146"
      ],
      "metrics": [
        {
          "type": "CVSS_V3",
          "score": "CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H"
        },
        {
          "type": "Ubuntu",
          "score": "medium"
        }
      ],
      "affected": [
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=xenial",
            "ecosystem": "Ubuntu:16.04:LTS"
          },
          "versions": [
            "1.6.4+dfsg-1build1",
            "1.6.5+dfsg-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "1.6.5+dfsg-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=esm-apps%2Fbionic",
            "ecosystem": "Ubuntu:Pro:18.04:LTS"
          },
          "versions": [
            "1.7.9+dfsg-2",
            "1.7.9+dfsg-2build1",
            "1.7.9+dfsg-2ubuntu0.18.04.1",
            "1.7.9+dfsg-2ubuntu0.18.04.2",
            "1.7.9+dfsg-2ubuntu0.18.04.2+esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "1.7.9+dfsg-2ubuntu0.18.04.2+esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=focal",
            "ecosystem": "Ubuntu:20.04:LTS"
          },
          "versions": [
            "2.4.5+dfsg-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "2.4.5+dfsg-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=esm-apps%2Fjammy",
            "ecosystem": "Ubuntu:Pro:22.04:LTS"
          },
          "versions": [
            "2.9.4+dfsg-2",
            "2.9.4+dfsg-3",
            "2.9.4+dfsg-3ubuntu0.1~esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "2.9.4+dfsg-3ubuntu0.1~esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=esm-apps%2Fnoble",
            "ecosystem": "Ubuntu:Pro:24.04:LTS"
          },
          "versions": [
            "3.2.1+dfsg-1",
            "3.2.1+dfsg-1ubuntu0.24.04.1~esm1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "3.2.1+dfsg-1ubuntu0.24.04.1~esm1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=questing",
            "ecosystem": "Ubuntu:25.10"
          },
          "versions": [
            "3.5.2+dfsg-1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "3.5.2+dfsg-1"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=stonking",
            "ecosystem": "Ubuntu:26.10"
          },
          "versions": [
            "3.5.2+dfsg-1build1",
            "3.5.2+dfsg-2"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "3.5.2+dfsg-2"
              }
            ]
          }
        },
        {
          "ranges": [
            {
              "type": "ECOSYSTEM",
              "events": [
                {
                  "introduced": "0"
                }
              ]
            }
          ],
          "package": {
            "name": "cimg",
            "purl": "pkg:deb/ubuntu/cimg?arch=source&distro=resolute",
            "ecosystem": "Ubuntu:26.04:LTS"
          },
          "versions": [
            "3.5.2+dfsg-1",
            "3.5.2+dfsg-1build1"
          ],
          "database_specific": {
            "source": "https://github.com/canonical/ubuntu-security-notices/blob/main/osv/cve/2026/UBUNTU-CVE-2026-42146.json"
          },
          "ecosystem_specific": {
            "binaries": [
              {
                "binary_name": "cimg-examples",
                "binary_version": "3.5.2+dfsg-1build1"
              }
            ]
          }
        }
      ],
      "modified": "2026-10-17T12:58:54.149194195Z",
      "provider": "osv",
      "upstream": [
        "CVE-2026-42146"
      ],
      "references": [
        "https://ubuntu.com/security/CVE-2026-42146",
        "https://www.cve.org/CVERecord?id=CVE-2026-42146",
        "https://github.com/GreycLab/CImg/security/advisories/GHSA-g54r-qmgx-c6fv",
        "https://github.com/GreycLab/CImg/issues/477"
      ]
    },
    "related_cves": [
      {
        "value": "CVE-2026-42146",
        "evidence": "/upstream"
      }
    ],
    "security_relevant": true,
    "severity_evidence": "/severity/0/score"
  },
  "source_id": "core-osv",
  "document_id": 359153,
  "published_at": "2026-05-04T18:16:00+00:00"
}