7.5high
libheif: unbounded heap allocation in HEIF sequence parser (stsz fixed-size mode missing bound check)
- Severity
- 7.5high CVSS:3.1 by GitHub_M
- Exploit likelihood
- 0.50% (higher than 44% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
Description
libheif is a HEIF and AVIF file format decoder and encoder. From 1.19.0 until 1.23.0, a crafted HEIF sequence accepted by heif_context_read_from_memory() with the msf1 sequence brand can cause unbounded heap allocation. In libheif/sequences/seq_boxes.cc, Box_stsz::parse() applies max_sequence_frames only to variable-size samples, so fixed-size mode accepts an attacker-controlled sample_count without a bound. In libheif/sequences/track.cc, Track::load() also adds current_sample_idx and samples_per_chunk in 32-bit arithmetic, allowing the consistency check to be bypassed by wraparound. The resulting values reach the Chunk::Chunk() allocation path, which can consume gigabytes of memory and crash or stall the process through memory exhaustion. This issue is fixed in version 1.23.0.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| strukturag libheif | >= 1.19.0, < 1.23.0 | CVE List |
Classification
What each source says
CVE List
libheif is a HEIF and AVIF file format decoder and encoder. From 1.19.0 until 1.23.0, a crafted HEIF sequence accepted by heif_context_read_from_memory() with the msf1 sequence brand can cause unbounded heap allocation. In libheif/sequences/seq_boxes.cc, Box_stsz::parse() applies max_sequence_frames only to variable-size samples, so fixed-size mode accepts an attacker-controlled sample_count without a bound. In libheif/sequences/track.cc, Track::load() also adds current_sample_idx and samples_per_chunk in 32-bit arithmetic, allowing the consistency check to be bypassed by wraparound. The resulting values reach the Chunk::Chunk() allocation path, which can consume gigabytes of memory and crash or stall the process through memory exhaustion. This issue is fixed in version 1.23.0.
NVD (es)
libheif es un decodificador y codificador de formato de archivo HEIF y AVIF. Desde la 1.19.0 hasta la 1.23.0, una secuencia HEIF manipulada aceptada por heif_context_read_from_memory() con la marca de secuencia msf1 puede causar una asignación de memoria dinámica (heap) ilimitada. En libheif/sequences/seq_boxes.cc, Box_stsz::parse() aplica max_sequence_frames solo a muestras de tamaño variable, por lo que el modo de tamaño fijo acepta un sample_count controlado por el atacante sin un límite. En libheif/sequences/track.cc, Track::load() también suma current_sample_idx y samples_per_chunk en aritmética de 32 bits, permitiendo que la verificación de consistencia sea eludida por desbordamiento. Los valores resultantes alcanzan la ruta de asignación de Chunk::Chunk(), lo que puede consumir gigabytes de memoria y bloquear o paralizar el proceso por agotamiento de memoria. Este problema está solucionado en la versión 1.23.0.
References
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-50142 changed 2026-08-19 | CVE Terms of Use |
| NVD | CVE-2026-50142 changed 2026-10-22 | Public domain |