CVE-2026-40493
JSON

9.8critical

SAIL has heap buffer overflow in PSD decoder — bpp mismatch in LAB 16-bit mode

Severity
9.8critical CVSS:3.1 by GitHub_M
Exploit likelihood
0.37% (higher than 33% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
GitHub_M

Description

SAIL is a cross-platform library for loading and saving images with support for animation, metadata, and ICC profiles. Prior to commit c930284445ea3ff94451ccd7a57c999eca3bc979, the PSD codec computes bytes-per-pixel (`bpp`) from raw header fields `channels * depth`, but the pixel buffer is allocated based on the resolved pixel format. For LAB mode with `channels=3, depth=16`, `bpp = (3*16+7)/8 = 6`, but the format `BPP40_CIE_LAB` allocates only 5 bytes per pixel. Every pixel write overshoots, causing a deterministic heap buffer overflow on every row. Commit c930284445ea3ff94451ccd7a57c999eca3bc979 contains a patch.

Affected

Product or packageVersionsReported by
HappySeaFox sail< c930284445ea3ff94451ccd7a57c999eca3bc979CVE List

Classification

CWE-787

SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.

What each source says

CVE List

SAIL is a cross-platform library for loading and saving images with support for animation, metadata, and ICC profiles. Prior to commit c930284445ea3ff94451ccd7a57c999eca3bc979, the PSD codec computes bytes-per-pixel (`bpp`) from raw header fields `channels * depth`, but the pixel buffer is allocated based on the resolved pixel format. For LAB mode with `channels=3, depth=16`, `bpp = (3*16+7)/8 = 6`, but the format `BPP40_CIE_LAB` allocates only 5 bytes per pixel. Every pixel write overshoots, causing a deterministic heap buffer overflow on every row. Commit c930284445ea3ff94451ccd7a57c999eca3bc979 contains a patch.

NVD (es)

SAIL es una biblioteca multiplataforma para cargar y guardar imágenes con soporte para animación, metadatos y perfiles ICC. Antes del commit c930284445ea3ff94451ccd7a57c999eca3bc979, el códec PSD calcula los bytes por píxel (’bpp’) a partir de los campos de encabezado sin procesar ’channels * depth’, pero el búfer de píxeles se asigna basándose en el formato de píxel resuelto. Para el modo LAB con ’channels=3, depth=16’, ’bpp = (316+7)/8 = 6’, pero el formato ’BPP40_CIE_LAB’ asigna solo 5 bytes por píxel. Cada escritura de píxel se excede, causando un desbordamiento de búfer de pila determinista en cada fila. El commit c930284445ea3ff94451ccd7a57c999eca3bc979 contiene un parche.

References

Sources

SourceRecordLicence
CVE ListCVE-2026-40493 changed 2026-04-20CVE Terms of Use
NVDCVE-2026-40493 changed 2026-10-26Public domain