CVE-2026-40492
JSON

9.8critical

SAIL has heap buffer overflow in XWD decoder — bits_per_pixel vs pixmap_depth type confusion in byte-swap

Severity
9.8critical CVSS:3.1 by GitHub_M
Exploit likelihood
0.42% (higher than 38% 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 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02, the XWD codec resolves pixel format based on `pixmap_depth` but the byte-swap code uses `bits_per_pixel` independently. When `pixmap_depth=8` (BPP8_INDEXED, 1 byte/pixel buffer) but `bits_per_pixel=32`, the byte-swap loop accesses memory as `uint32_t*`, reading/writing 4x the allocated buffer size. This is a different vulnerability from the previously reported GHSA-3g38-x2pj-mv55 (CVE-2026-27168), which addressed `bytes_per_line` validation. Commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 contains a patch.

Affected

Product or packageVersionsReported by
HappySeaFox sail< 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02CVE 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 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02, the XWD codec resolves pixel format based on `pixmap_depth` but the byte-swap code uses `bits_per_pixel` independently. When `pixmap_depth=8` (BPP8_INDEXED, 1 byte/pixel buffer) but `bits_per_pixel=32`, the byte-swap loop accesses memory as `uint32_t*`, reading/writing 4x the allocated buffer size. This is a different vulnerability from the previously reported GHSA-3g38-x2pj-mv55 (CVE-2026-27168), which addressed `bytes_per_line` validation. Commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 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 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02, el códec XWD resuelve el formato de píxel basándose en pixmap_depth pero el código de intercambio de bytes utiliza bits_per_pixel de forma independiente. Cuando pixmap_depth=8 (BPP8_INDEXED, búfer de 1 byte/píxel) pero bits_per_pixel=32, el bucle de intercambio de bytes accede a la memoria como uint32_t, leyendo/escribiendo 4 veces el tamaño del búfer asignado. Esta es una vulnerabilidad diferente de la previamente reportada GHSA-3g38-x2pj-mv55 (CVE-2026-27168), que abordaba la validación de bytes_per_line. El commit 36aa5c7ec8a2bb35f6fb867a1177a6f141156b02 contiene un parche.

References

Sources

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