# CVE-2025-59729: Heap-buffer-overflow read in FFmpeg DHAV get_duration

> An integer underflow in FFmpeg's DHAV parser allows heap buffer over-reads, potentially leading to code execution or crashes when processing malicious files.

- **Severity:** Medium 5.7 (`CVSS:4.0/AV:A/AC:H/AT:P/PR:L/UI:P/VC:L/VI:H/VA:N/SC:L/SI:H/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 6 Oct 2025
- **Updated:** 6 Oct 2025
- **Also known as:** GHSA-j8h4-v947-5h7q, MINI-rrcg-j97p-747v, UBUNTU-CVE-2025-59729

## What is CVE-2025-59729?

CVE-2025-59729 is a medium-severity vulnerability in FFmpeg, published on 6 Oct 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

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

Weakness: CWE-787 (Out-of-bounds Write)

## Which versions are affected by CVE-2025-59729?


## How do I fix CVE-2025-59729?

No fix has been published for CVE-2025-59729 yet. Limit exposure of the affected software until one is available.

## Is CVE-2025-59729 being exploited?

There is no known exploitation of CVE-2025-59729 in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-59729 and fix it if it is affected.

What it is: CVE-2025-59729 is a medium-severity vulnerability in FFmpeg, published on 6 Oct 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of CVE-2025-59729 in the wild and no public exploit code.

Affected product: FFmpeg. No package-level version data is available, so check the vendor advisory linked from the reference page.

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-59729/ (Markdown: https://insights.sbomify.com/CVE-2025-59729/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-59729
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-59729
- OSV: https://osv.dev/vulnerability/CVE-2025-59729

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-59729/
Summaries are generated and may contain mistakes; the official description above is the record.
