All reports
Medium

stb: heap-based buffer overflow in stb_image PNM loader

Affected versions

Affected versions
Unknown
Fixed version
Not reported

Exploitation

CVE-2021-42716

Probability of exploitation in the next 30 days: 1.46%

FIRST EPSS · 2026-11-22

Description

An issue was discovered in stb stb_image.h 2.27. The PNM loader incorrectly interpreted 16-bit PGM files as 8-bit when converting to RGBA, leading to a buffer overflow when later reinterpreting the result as a 16-bit buffer. An attacker could potentially have crashed a service using stb_image, or read up to 1024 bytes of non-consecutive heap data without control over the read location.