CVE-2023-45666
Possible double-free or memory leak in stbi__load_gif_main in stb_image
CVE-2023-45666 is a high vulnerability (CVSS 7.3) in Nothings Stb, published October 20, 2023. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.07%, the 64th percentile. Fixed in stb 0_git20231012-r0.
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- Low
- Integrity
- Low
- Availability
- Low
Exploit likelihood
What each source reports
CVE List Score used
7.3
Possible double-free or memory leak in stbi__load_gif_main in stb_image
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
CVE-2023-45666- CVSS 3.1
- 7.3 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L - Weakness
- CWE-415
- Updated
- 2026-11-02
EUVDEUVD-2023-49957
7.3
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
EUVD-2023-49957- CVSS 3.1
- 7.3 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L - Updated
- 2026-11-03
NVD
7.3
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
CVE-2023-45666- CVSS 3.1
- 7.3 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L - CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-415
- Updated
- 2026-11-02
OSVALPINE-CVE-2023-45666
9.8
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
ALPINE-CVE-2023-45666- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-03
OSV
7.3
Possible double-free or memory leak in stbi__load_gif_main in stb_image
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
CVE-2023-45666- CVSS 3.1
- 7.3 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L - Weakness
- CWE-415
- Updated
- 2026-11-02
OSVDEBIAN-CVE-2023-45666
9.8
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
DEBIAN-CVE-2023-45666- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVOESA-2024-1262
9.8
stb security update
Single-file public domain libraries for C/C++.
Security Fix(es):
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed(CVE-2023-45666)
stb_image is a single file MIT licensed library for processing images.
If stbi__load_gif_main in stbi_load_gif_from_memory fails it returns a null pointer and may keep the z variable uninitialized. In case the caller also sets the flip vertically flag, it continues and calls stbi__vertical_flip_slices with the null pointer result value and the uninitialized z value. This may result in a program crash.(CVE-2023-45667)
- Record
OESA-2024-1262- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVOESA-2024-1263
9.8
stb security update
Single-file public domain libraries for C/C++.
Security Fix(es):
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed(CVE-2023-45666)
stb_image is a single file MIT licensed library for processing images.
If stbi__load_gif_main in stbi_load_gif_from_memory fails it returns a null pointer and may keep the z variable uninitialized. In case the caller also sets the flip vertically flag, it continues and calls stbi__vertical_flip_slices with the null pointer result value and the uninitialized z value. This may result in a program crash.(CVE-2023-45667)
- Record
OESA-2024-1263- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVUBUNTU-CVE-2023-45666
7.3
stb_image is a single file MIT licensed library for processing images. It may look like stbi__load_gif_main doesn’t give guarantees about the content of output value *delays upon failure. Although it sets *delays to zero at the beginning, it doesn’t do it in case the image is not recognized as GIF and a call to stbi__load_gif_main_outofmem only frees possibly allocated memory in *delays without resetting it to zero. Thus it would be fair to say the caller of stbi__load_gif_main is responsible to free the allocated memory in *delays only if stbi__load_gif_main returns a non null value. However at the same time the function may return null value, but fail to free the memory in *delays if internally stbi__convert_format is called and fails. Thus the issue may lead to a memory leak if the caller chooses to free delays only when stbi__load_gif_main didn’t fail or to a double-free if the delays is always freed
- Record
UBUNTU-CVE-2023-45666- CVSS 3.1
- 7.3 High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:L - CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
stbAlpine:v3.19 |
before 0_git20231012-r0 | 0_git20231012-r0 |
stbAlpine:v3.20 |
before 0_git20231012-r0 | 0_git20231012-r0 |
stbAlpine:v3.21 |
before 0_git20231012-r0 | 0_git20231012-r0 |
stbAlpine:v3.22 |
before 0_git20231012-r0 | 0_git20231012-r0 |
stbAlpine:v3.23 |
before 0_git20231012-r0 | 0_git20231012-r0 |
stbAlpine:v3.24 |
before 0_git20231012-r0 | 0_git20231012-r0 |
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 |
All versions, plus listed versions 0.0~git20241109.5c20573+ds-10.0~git20250907.fede005+ds-1 |
None known |
libstbDebian:14 |
All versions, plus listed versions 0.0~git20241109.5c20573+ds-10.0~git20250907.fede005+ds-1 |
None known |
stbopenEuler:22.03-LTS-SP3 |
before 0.20220908git8b5f1f3-0.12.oe2203sp3 | 0.20220908git8b5f1f3-0.12.oe2203sp3 |
Show 7 moreShow less
| Package | Affected | Fixed |
|---|---|---|
stbopenEuler:22.03-LTS-SP2 |
before 0.20220908git8b5f1f3-0.12.oe2203sp2 | 0.20220908git8b5f1f3-0.12.oe2203sp2 |
libstbUbuntu:20.04:LTS |
All versions, plus listed versions 0.0~git20190817.1.052dce1-1 |
None known |
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 |
History
| When | Changed | Sources |
|---|---|---|
| 2026-11-03 | affected, aliases, references | OSV |
| 2026-11-03 | aliases, published | EUVD |
| 2026-11-02 | created | CVE List, NVD, OSV |
References
securitylab.github.com/advisories/GHSL-2023-145_GHSL-2023-151_stb_image_h
github.com/nothings/stb/blob/5736b15f7ea0ffb08dd38af21067c314d6a3aae9/stb_image.h
lists.fedoraproject.org/archives/list/[email protected]/message/UVQ7ONFH5GWLMXYEAJG32A3EUKUCEVCR
lists.fedoraproject.org/archives/list/[email protected]/message/QVABVF4GEM6BYD5L4L64RCRSXUHY6LGN
lists.fedoraproject.org/archives/list/[email protected]/message/NMXKOKPP4BKTNUTF5KSRDQAWOUILQZNO
security.alpinelinux.org/vuln/CVE-2023-45666
Show 8 moreShow less
github.com/CVEProject/cvelistV5/tree/main/cves/2023/45xxx/CVE-2023-45666.json
nvd.nist.gov/vuln/detail/CVE-2023-45666
security-tracker.debian.org/tracker/CVE-2023-45666
openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2024-1262
nvd.nist.gov/vuln/detail/CVE-2023-45667
openeuler.org/en/security/safety-bulletin/detail.html?id=openEuler-SA-2024-1263
ubuntu.com/security/CVE-2023-45666
cve.org/CVERecord?id=CVE-2023-45666