CVE-2021-42716
An issue was discovered in stb stb_image.h 2.27. The PNM loader incorrectly interpreted 16-bit...
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.
Attack profile
How easy it is to exploit
- Attack vector
- Local
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Required
What an attacker can affect
- Confidentiality
- High
- Integrity
- None
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
7.1
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.
- Record
CVE-2021-42716- CVSS 3.1
- 7.1 High
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H - CVSS 2.0
- 5.8 Medium
AV:N/AC:M/Au:N/C:P/I:N/A:P - Weakness
- CWE-120
- Updated
- 2026-11-02
CVE List No score
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.
- Record
CVE-2021-42716- Updated
- 2026-11-02
EUVDEUVD-2021-29676 No score
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.
- Record
EUVD-2021-29676- Updated
- 2026-11-03
GitHub AdvisoriesGHSA-44mr-92xw-jfrv
9.1
An issue was discovered in stb stb_image.h 2.27. The PNM loader incorrectly interpreted 16-bit...
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.
- Record
GHSA-44mr-92xw-jfrv- CVSS 3.1
- 9.1 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:H - Weakness
- CWE-120
- Updated
- 2026-11-02
OSV
7.1
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.
- Record
CVE-2021-42716- CVSS 3.1
- 7.1 High
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H - Updated
- 2026-11-02
OSVDEBIAN-CVE-2021-42716
7.1
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.
- Record
DEBIAN-CVE-2021-42716- CVSS 3.1
- 7.1 High
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H - Updated
- 2026-11-02
Show 8 moreShow less
OSVUBUNTU-CVE-2021-42716
7.1
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.
- Record
UBUNTU-CVE-2021-42716- CVSS 3.1
- 7.1 High
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:N/A:H - Updated
- 2026-11-02
OSVMGASA-2021-0549 No score
Updated curaengine packages fix security vulnerability
Buffer overflow vulnerability in function stbi__extend_receive in stb_image.h in stb 2.26 via a crafted JPEG file. (CVE-2021-28021)
An issue was discovered in stb stb_image.h 1.33 through 2.27. The HDR loader parsed truncated end-of-file RLE scanlines as an infinite sequence of zero-length runs. An attacker could potentially have caused denial of service in applications using stb_image by submitting crafted HDR files. (CVE-2021-42715)
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. (CVE-2021-42716)
- Record
MGASA-2021-0549- Updated
- 2026-11-02
OSVMGASA-2022-0074 No score
Updated zxing-cpp packages fix security vulnerability
Buffer overflow vulnerability in function stbi__extend_receive in stb_image.h in stb 2.26 via a crafted JPEG file. (CVE-2021-28021)
An issue was discovered in stb stb_image.h 1.33 through 2.27. The HDR loader parsed truncated end-of-file RLE scanlines as an infinite sequence of zero-length runs. An attacker could potentially have caused denial of service in applications using stb_image by submitting crafted HDR files. (CVE-2021-42715)
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. (CVE-2021-42716)
- Record
MGASA-2022-0074- Updated
- 2026-11-02
OSVopenSUSE-SU-2022:0018-1 No score
Security update for stb
This update for stb fixes the following issues:
- CVE-2021-42716: fixed buffer overflow in stb_image PNM loader (boo#1191743)
- Record
openSUSE-SU-2022:0018-1- Updated
- 2026-11-02
OSVopenSUSE-SU-2022:0157-1 No score
Security update for zxing-cpp
This update for zxing-cpp fixes the following issues:
- CVE-2021-28021: Fixed buffer overflow vulnerability in function stbi__extend_receive in stb_image.h via a crafted JPEG file. (bsc#1191743).
- CVE-2021-42715: Fixed buffer overflow in stb_image PNM loader (bsc#1191942).
- CVE-2021-42716: Fixed denial of service in stb_image HDR loader when reading crafted HDR files (bsc#1191944).
- Record
openSUSE-SU-2022:0157-1- Updated
- 2026-11-02
OSVopenSUSE-SU-2024:11686-1 No score
libZXing1-1.2.0-2.1 on GA media
These are all security issues fixed in the libZXing1-1.2.0-2.1 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2024:11686-1- Updated
- 2026-11-02
OSVSUSE-SU-2022:0157-1 No score
Security update for zxing-cpp
This update for zxing-cpp fixes the following issues:
- CVE-2021-28021: Fixed buffer overflow vulnerability in function stbi__extend_receive in stb_image.h via a crafted JPEG file. (bsc#1191743).
- CVE-2021-42715: Fixed buffer overflow in stb_image PNM loader (bsc#1191942).
- CVE-2021-42716: Fixed denial of service in stb_image HDR loader when reading crafted HDR files (bsc#1191944).
- Record
SUSE-SU-2022:0157-1- Updated
- 2026-11-02
OSVSUSE-SU-2022:0163-1 No score
Security update for zxing-cpp
This update for zxing-cpp fixes the following issues:
- CVE-2021-28021: Fixed buffer overflow vulnerability in function stbi__extend_receive in stb_image.h via a crafted JPEG file. (bsc#1191743).
- CVE-2021-42715: Fixed buffer overflow in stb_image PNM loader (bsc#1191942).
- CVE-2021-42716: Fixed denial of service in stb_image HDR loader when reading crafted HDR files (bsc#1191944).
- Record
SUSE-SU-2022:0163-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
libstbDebian:12 |
All versions, plus listed versions 0.0~git20220908.8b5f1f3+ds-10.0~git20230129.5736b15+ds-10.0~git20230129.5736b15+ds-1.10.0~git20230129.5736b15+ds-1.1~exp10.0~git20230129.5736b15+ds-1.20.0~git20240715.f7f20f39fe4f+ds-10.0~git20241109.5c20573+ds-10.0~git20250907.fede005+ds-1 |
None known |
libstbDebian:13 |
before 0.0~git20230129.5736b15+ds-1 | 0.0~git20230129.5736b15+ds-1 |
libstbDebian:14 |
before 0.0~git20230129.5736b15+ds-1 | 0.0~git20230129.5736b15+ds-1 |
curaengineMageia:8 From an advisory covering 3 CVEs |
before 4.8.0-1.1.mga8 | 4.8.0-1.1.mga8 |
zxing-cppMageia:8 From an advisory covering 3 CVEs |
before 1.1.1-2.1.mga8 | 1.1.1-2.1.mga8 |
zxing-cppSUSE:Linux Enterprise Module for Package Hub 15 SP3 From an advisory covering 3 CVEs |
before 1.2.0-9.7.1 | 1.2.0-9.7.1 |
zxing-cppSUSE:Linux Enterprise Workstation Extension 15 SP3 From an advisory covering 3 CVEs |
before 1.2.0-9.7.1 | 1.2.0-9.7.1 |
zxing-cppSUSE:Linux Enterprise Software Development Kit 12 SP5 From an advisory covering 3 CVEs |
before 1.2.0-8.6.1 | 1.2.0-8.6.1 |
zxing-cppSUSE:Linux Enterprise Workstation Extension 12 SP5 From an advisory covering 3 CVEs |
before 1.2.0-8.6.1 | 1.2.0-8.6.1 |
libstbUbuntu:20.04:LTS |
All versions, plus listed versions 0.0~git20190817.1.052dce1-1 |
None known |
Show 8 moreShow less
| Package | Affected | Fixed |
|---|---|---|
libstbUbuntu:22.04:LTS |
All versions, plus listed versions 0.0~git20200713.b42009b+ds-10.0~git20210910.af1a5bc+ds-1 |
None known |
libstbUbuntu:24.04:LTS |
All versions, plus listed versions 0.0~git20230129.5736b15+ds-10.0~git20230129.5736b15+ds-1.10.0~git20230129.5736b15+ds-1.2 |
None known |
libstbUbuntu:25.10 |
All versions, plus listed versions 0.0~git20240715.f7f20f39fe4f+ds-10.0~git20241109.5c20573+ds-1 |
None known |
libstbUbuntu:26.10 |
All versions, plus listed versions 0.0~git20250907.fede005+ds-1 |
None known |
libstbUbuntu:26.04:LTS |
All versions, plus listed versions 0.0~git20241109.5c20573+ds-10.0~git20250907.fede005+ds-1 |
None known |
stbSUSE:Package Hub 15 SP3 |
before 2.32.1549563867.59e9702-bp153.2.3.1 | 2.32.1549563867.59e9702-bp153.2.3.1 |
stbopenSUSE:Leap 15.3 |
before 2.32.1549563867.59e9702-bp153.2.3.1 | 2.32.1549563867.59e9702-bp153.2.3.1 |
zxing-cppopenSUSE:Leap 15.3 From an advisory covering 3 CVEs |
before 1.2.0-9.7.1 | 1.2.0-9.7.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2021-42716 is a high vulnerability (CVSS 7.1) in Fedoraproject Fedora, published October 21, 2021. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.46%, the 73rd percentile. Fixed in libstb 0.0~git20230129.5736b15+ds-1.
References
github.com/nothings/stb/issues/1166
github.com/nothings/stb/pull/1223
github.com/nothings/stb/issues/1225
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/G2M5CRSGPRF7G3YB5CLU4FXW7ANNHAYT
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/ID6II3RIKAMVGVMC6ZAQIXXYYDMTVC4N
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/BEGXBDEMTFGINETMJENBZ6SCHVEJQJSY
Show 35 moreShow less
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/CI23LXPEV2GCDQTJSKO6CIILBDTI3R42
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/FTZXHFZD36BGE5P6JF252NZZLKMGCY4T
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/VP2YEXEAJWI76FPM7D7VXHWD3WESQEYC
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/3TDGZFLBOP27LZKLH45WQLSNPSPP7S7Z
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/AF2CNP4FVC6LDKNOO4WDCGNDYIP3MPK6
lists.fedoraproject.org/archives/list/package-announce%40lists.fedoraproject.org/message/TXX76TJMZBPN3NU542MGN6B7C7QHRFGB
nvd.nist.gov/vuln/detail/CVE-2021-42716
lists.fedoraproject.org/archives/list/[email protected]/message/3TDGZFLBOP27LZKLH45WQLSNPSPP7S7Z
lists.fedoraproject.org/archives/list/[email protected]/message/AF2CNP4FVC6LDKNOO4WDCGNDYIP3MPK6
lists.fedoraproject.org/archives/list/[email protected]/message/BEGXBDEMTFGINETMJENBZ6SCHVEJQJSY
lists.fedoraproject.org/archives/list/[email protected]/message/CI23LXPEV2GCDQTJSKO6CIILBDTI3R42
lists.fedoraproject.org/archives/list/[email protected]/message/FTZXHFZD36BGE5P6JF252NZZLKMGCY4T
lists.fedoraproject.org/archives/list/[email protected]/message/G2M5CRSGPRF7G3YB5CLU4FXW7ANNHAYT
lists.fedoraproject.org/archives/list/[email protected]/message/ID6II3RIKAMVGVMC6ZAQIXXYYDMTVC4N
lists.fedoraproject.org/archives/list/[email protected]/message/TXX76TJMZBPN3NU542MGN6B7C7QHRFGB
lists.fedoraproject.org/archives/list/[email protected]/message/VP2YEXEAJWI76FPM7D7VXHWD3WESQEYC
github.com/advisories/GHSA-44mr-92xw-jfrv
security-tracker.debian.org/tracker/CVE-2021-42716
advisories.mageia.org/MGASA-2021-0549.html
bugs.mageia.org/show_bug.cgi?id=29622
lists.fedoraproject.org/archives/list/[email protected]/thread/3TDGZFLBOP27LZKLH45WQLSNPSPP7S7Z
advisories.mageia.org/MGASA-2022-0074.html
bugs.mageia.org/show_bug.cgi?id=29937
lists.opensuse.org/archives/list/[email protected]/thread/TPIWID3WJ3SMCA23W52QU3RW6AU7JCA7
suse.com/support/update/announcement/2022/suse-su-20220157-1
bugzilla.suse.com/1191743
bugzilla.suse.com/1191942
bugzilla.suse.com/1191944
suse.com/security/cve/CVE-2021-28021
suse.com/security/cve/CVE-2021-42715
suse.com/security/cve/CVE-2021-42716
suse.com/support/update/announcement/2022/suse-su-20220163-1
ubuntu.com/security/CVE-2021-42716
cve.org/CVERecord?id=CVE-2021-42716
lists.opensuse.org/archives/list/[email protected]/thread/G7QRUVRJT5W72APQEDYOZEMCHXZ5CMDO