libheif HEIF and AVIF File Format Library Denial-of-Service Vulnerability via Crafted HEIF Sequence Files

Vulnerability

A denial-of-service vulnerability has been identified in libheif, a library for decoding and encoding HEIF and AVIF file formats. This issue affects versions through 1.21.2. The vulnerability arises when a specially crafted 792-byte HEIF sequence file is processed. The file contains a 'samples_per_chunk' value of 0 in the 'stsc' box, which leads to an unsigned integer underflow in the Chunk constructor. This underflow maps all samples to an empty chunk. When any sample is accessed, the library attempts to read from the first index of an empty vector, resulting in a segmentation fault due to a null-page read. The file is parsed successfully without errors, and the crash occurs upon the first frame access, making this a reliable denial-of-service vector.

Impact

Exploitation of this vulnerability causes an immediate and deterministic process crash due to a segmentation fault, as the library tries to read sample data from an empty vector.

Reproduction

The vulnerability can be reproduced by creating a valid two-frame HEIF sequence file using the libheif API, then patching the 'stsc' box to set 'samples_per_chunk' to 0. This modified file, when opened, will parse without error but will cause a segmentation fault on the first sample access.

Remediation

Users should update to libheif version 1.22.0 or later, where this vulnerability has been fixed.

Added: May 19, 2026, 7:27 PM
Updated: May 19, 2026, 7:27 PM

Vulnerability Rating

Custom Algorithm
spread
0.0
impact
2.5
exploitability
7.5
remediation
0.0
relevance
8.8
threat
6.4
urgency
2.9
incentive
0.0

Our algorithm analyzes dozens of metrics to generate these 8 key vulnerability categories, which are then combined to calculate the overall risk score.