Skip to content
OpenAdvisories
Medium · 5.7 CVE-2025-59729 EUVD-2025-32182GHSA-j8h4-v947-5h7q

Heap-buffer-overflow read in FFmpeg DHAV get_duration

Published Oct 6, 2025 · Updated Oct 6, 2025 · Assigned by Google

Description

When parsing the header for a DHAV file, there's an integer underflow in offset calculation that leads to reading the duration from before the start of the allocated buffer.

If we load a DHAV file that is larger than MAX_DURATION_BUFFER_SIZE bytes (0x100000) for example 0x101000 bytes, then at [0] we have size = 0x101000. At [1] we have end_buffer_size = 0x100000, and at [2] we have end_buffer_pos = 0x1000.

The loop then scans backwards through the buffer looking for the dhav tag; when it is found, we'll calculate end_pos based on a 32-bit offset read from the buffer.

There is subsequently a check [3] that end_pos is within the section of the file that has been copied into end_buffer, but it only correctly handles the cases where end_pos is before the start of the file or after the section copied into end_buffer, and not the case where end_pos is within the the file, but before the section copied into end_buffer. If we provide such an offset, (end_pos - end_buffer_pos) can underflow, resulting in the subsequent access at [4] occurring before the beginning of the allocation.

We recommend upgrading to version 8.0 or beyond.

Affected products

VendorProductAffectedFixed
FFmpeg FFmpeg a218cafe4d3be005ab0c61130f90db4d21afb5db – < 8.0 8.0

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Ubuntu Pro 14.04 LTS libav No fix yet —
ReleasePackageFixed inAdvisory
Alpine v3.24 ffmpeg 8.0-r0 —
Alpine v3.23 ffmpeg 8.0-r0 —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling ffmpeg-7 7.1.5-r3 —
Wolfi rolling ffmpeg-7.1 7.1.5-r4 —

Advisories 1

References