---
id: CVE-2025-68431
title: libheif is an HEIF and AVIF file format decoder and encoder
summary: >-
  libheif is an HEIF and AVIF file format decoder and encoder. Prior to version
  1.21.0, a crafted HEIF that exercises the overlay image item path triggers a
  heap buffer over-read in `HeifPixelImage::overlay()`. The function computes a
  nega…
severity: medium
cvss: 6.5
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:N/A:H'
cwe:
  - CWE-125
  - CWE-190
vendor: struktur
product: libheif
affected:
  - libheif < 1.21.0
patched:
  - libheif 1.21.0
published: '2025-12-29'
updated: '2026-10-07'
sourceUpdated: '2026-10-07T12:10:00.170'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2025-68431'
references:
  - url: >-
      https://github.com/strukturag/libheif/commit/b8c12a7b70f46c9516711a988483bed377b78d46
    label: security-advisories@github.com
  - url: 'https://github.com/strukturag/libheif/releases/tag/v1.21.0'
    label: security-advisories@github.com
  - url: >-
      https://github.com/strukturag/libheif/security/advisories/GHSA-j87x-4gmq-cqfq
    label: security-advisories@github.com
tags:
  - nvd
epss: 0.00427
epssPercentile: 0.34826
ingestedAt: '2026-10-07T12:29:01.341Z'
---

## Overview

libheif is an HEIF and AVIF file format decoder and encoder. Prior to version 1.21.0, a crafted HEIF that exercises the overlay image item path triggers a heap buffer over-read in `HeifPixelImage::overlay()`. The function computes a negative row length (likely from an unclipped overlay rectangle or invalid offsets), which then underflows when converted to `size_t` and is passed to `memcpy`, causing a very large read past the end of the source plane and a crash. Version 1.21.0 contains a patch. As a workaround, avoid decoding images using `iovl` overlay boxes.

## Affected

- `libheif < 1.21.0`

## Remediation

Upgrade past the affected range:

- `libheif 1.21.0`
