CVE-2025-68431: Heif Pixelimage Overlay Memcpy Underflow

A vulnerability exists where the `memcpy` size parameter is computed as `$W - $IX` after `$W` may have already been restricted to the remaining width. Subtracting `$IX` causes an underflow when cast to `size_t`, leading to a massive heap buffer over-read. Use the available dimension `$W` directly for the copy size.

Provally CuratedPublic repositoryHighMedium confidenceVerifiedApache-2.0C++
greprules fetch cve-2025-68431-heif-pixelimage-overlay-memcpy-underflow --engine opengrep

Description

A vulnerability exists where the `memcpy` size parameter is computed as `$W - $IX` after `$W` may have already been restricted to the remaining width. Subtracting `$IX` causes an underflow when cast to `size_t`, leading to a massive heap buffer over-read. Use the available dimension `$W` directly for the copy size.