Memory corruption via zero-size realloc double-free
Published Mar 31, 2026 · Updated Mar 31, 2026
Double-free in stb_image.h in Sean Barrett stb 2.30 and earlier allows local users to corrupt heap memory via a crafted multi-frame GIF. The out-of-memory path in stbi__load_gif_main passes a zero-sized layers-by-stride allocation to realloc, then frees the retained out pointer again when realloc returns null. Reaching the fault requires a multi-threaded host application to decode the crafted GIF; the demonstrated result is an AddressSanitizer-detected double-free, while code execution is only the reported upper bound.
Summary
What happened
Double-free in stb_image.h in Sean Barrett stb 2.30 and earlier allows local users to corrupt heap memory via a crafted multi-frame GIF. The out-of-memory path in stbi__load_gif_main passes a zero-sized layers-by-stride allocation to realloc, then frees the retained out pointer again when realloc returns null. Reaching the fault requires a multi-threaded host application to decode the crafted GIF; the demonstrated result is an AddressSanitizer-detected double-free, while code execution is only the reported upper bound.
The record
- CVE
- CVE-2026-5186
- Published
- Mar 31, 2026
- Updated
- Mar 31, 2026
- Vendor
- Sean Barrett
- Product
- stb
- Classifications
- CWE-119, CWE-415, T1203
- Attack vector
- local
- Privileges
- authenticated
Timeline
How it unfolded
- Mar 31, 2026CVE publishedPublication date reported by the CVE source.
- Mar 31, 2026Record updatedLatest update available in the CVE record.
Exploitability
Present is not the same as exploitable
Compare your product and version with the public record. A matching version still requires validation against your environment.
Is a vulnerable build present?
Compare these published version ranges with your installed build and any vendor patches.
- Affected versionversion=2.0
- Affected versionversion=2.1
- Affected versionversion=2.10
- Affected versionversion=2.11
- Affected versionversion=2.12
- Affected versionversion=2.13
- Affected versionversion=2.14
- Affected versionversion=2.15
- Affected versionversion=2.16
- Affected versionversion=2.17
- Affected versionversion=2.18
- Affected versionversion=2.19
- Affected versionversion=2.2
- Affected versionversion=2.20
- Affected versionversion=2.21
- Affected versionversion=2.22
- Affected versionversion=2.23
- Affected versionversion=2.24
- Affected versionversion=2.25
- Affected versionversion=2.26
- Affected versionversion=2.27
- Affected versionversion=2.28
- Affected versionversion=2.29
- Affected versionversion=2.3
- Affected versionversion=2.30
- Affected versionversion=2.4
- Affected versionversion=2.5
- Affected versionversion=2.6
- Affected versionversion=2.7
- Affected versionversion=2.8
- Affected versionversion=2.9
What conditions does exploitation require?
What is affected?
Attacks
What attackers are doing with it
Daily unique IPs observed by Shadowserver honeypots for known exploited vulnerabilities (KEVs). Missing observations do not establish an absence of attacks.
Weakness, pattern, technique
Public exploit references
- GitHub Security Lab stbi__load_gif_main reproducerproof of concept · demonstrated
Labels summarize the accepted research assessment. They do not indicate a test against your environment.
Technologies
Your stack
See the directory against your own environment.
Your stack
Check the software in your environment
Book a demo to see how Hinoki identifies affected software and validates exploitability in your environment.
Book a demo