Skip to content
Memory corruption Advisory Advanced CVE-2026-24660

LibRaw x3f_load_huffman heap-based buffer overflow vulnerability

A heap-based buffer overflow exists in LibRaw's x3f_load_huffman function because the buffer size calculation uses 32-bit arithmetic that can overflow when processing attacker-controlled image dimensions. An attacker could provide a malicious X3F file to cause heap corruption and potentially achieve code execution.

Francesco Benvenuto Follow

Originally disclosed on Cisco Talos

High 8.1 View original

A heap-based buffer overflow vulnerability exists in the x3floadhuffman functionality of LibRaw Commit d20315b. A specially crafted malicious file can lead to a heap buffer overflow.

Francesco Benvenuto, on Cisco Talos

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

How it worked

Root cause

The buffer size calculation multiplies two 32-bit image dimensions and then by 3, which can overflow and produce a much smaller allocation than needed.

Impact

This heap buffer overflow can lead to heap corruption and potential code execution, but it is not exploitable with the default max_raw_memory_mb setting and requires LibRaw to be compiled with X3F support.

What the attacker needed

LibRaw compiled with -DUSE_X3FTOOLS; max_raw_memory_mb set to around 11 GB or more; attacker provides a malicious X3F file

The fix

The vulnerability was fixed in a vendor patch release.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.

LibRaw is a library for reading RAW image files. When it processes a special image format called X3F, it calculates how much memory to reserve for the image data. If the image dimensions are very large, the calculation can wrap around to a small number, so the program reserves too little memory and then writes past the end of it, corrupting other data.

What is Memory corruption?

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.

More by Francesco Benvenuto

View all

152 more disclosed reports, best first.

More from Cisco Talos

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.