Executive brief
libheif is a software library used by many applications to open and process HEIF and AVIF image files. A vulnerability in this library allows an attacker to crash any application that attempts to process a specially crafted image file. This results in a denial-of-service, potentially disrupting services or applications that handle user-uploaded images or media.
Technical details
A vulnerability exists in libheif versions 1.21.2 and below due to missing validation of the 'samples_per_chunk' field in the 'stsc' (sample-to-chunk) box. When this value is set to zero, it triggers an unsigned integer underflow in the Chunk constructor (m_last_sample = 0 + 0 - 1 = UINT32_MAX). This causes all samples to be mapped to an empty chunk. When an application attempts to access the first frame, the library performs an out-of-bounds read on an empty std::vector in 'Chunk::get_data_extent_for_sample()', resulting in a segmentation fault (SEGV). The issue is fixed in version 1.22.0.
Affected products
- strukturag libheif <= 1.21.2
Timeline
- 2026-05-19: advisory: GitHub Advisory GHSA-7f2h-cmpf-v9ww published
- 2026-05-19: disclosed: CVE-2026-32738 published to NVD
- 2026-05-19: patched: Fixed in version 1.22.0