6.1medium
CImg Library: Integer overflow in PNM size check bypasses memory guard (_load_pnm)
- Severity
- 6.1medium CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.15% (higher than 4% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
Description
CImg Library is a C++ library for image processing. Prior to commit 4ca26bc, there is an integer overflow vulnerability in the W*H*D size computation inside _load_pnm() that can bypass the memory allocation guard. A crafted PNM/PGM/PPM file with large dimension values causes the overflow to wrap around, allocating an undersized buffer and potentially triggering a heap buffer overflow. Any application using CImg to load untrusted image files is affected. This issue has been patched via commit 4ca26bc.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| GreycLab CImg | < 4ca26bce4d8c61fcd1507d5f9401b9fb1222c27d | CVE List |
Classification
SSVC (CISA-ADP): exploitation none, automatable no, technical impact partial.
What each source says
CVE List
CImg Library is a C++ library for image processing. Prior to commit 4ca26bc, there is an integer overflow vulnerability in the W*H*D size computation inside _load_pnm() that can bypass the memory allocation guard. A crafted PNM/PGM/PPM file with large dimension values causes the overflow to wrap around, allocating an undersized buffer and potentially triggering a heap buffer overflow. Any application using CImg to load untrusted image files is affected. This issue has been patched via commit 4ca26bc.
NVD (es)
Biblioteca CImg es una biblioteca de C++ para procesamiento de imágenes. Antes del commit 4ca26bc, existe una vulnerabilidad de desbordamiento de entero en el cálculo del tamaño WHD dentro de _load_pnm() que puede eludir la protección de asignación de memoria. Un archivo PNM/PGM/PPM manipulado con valores de dimensión grandes provoca que el desbordamiento se ajuste, asignando un búfer de tamaño insuficiente y potencialmente desencadenando un desbordamiento de búfer en el heap. Cualquier aplicación que utilice CImg para cargar archivos de imagen no confiables se ve afectada. Este problema ha sido parcheado mediante el commit 4ca26bc.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-42144 changed 2026-05-05 | CVE Terms of Use |
| NVD | CVE-2026-42144 changed 2026-10-26 | Public domain |