Skip to content
OpenAdvisories
High · 7.3 CVE-2023-45666 EUVD-2023-49957

Possible double-free or memory leak in stbi__load_gif_main in stb_image

Published Oct 20, 2023 · Updated Feb 13, 2025 · Assigned by GitHub_M

Description

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

Affected products

VendorProductAffectedFixed
nothings stb <= 2.28 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 libstb No fix yet —
Debian 13 libstb No fix yet —
Debian 12 libstb No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 libstb No fix yet —
Ubuntu 26.04 LTS libstb No fix yet —
Ubuntu 25.10 libstb No fix yet —
Ubuntu 24.04 LTS libstb No fix yet —
Ubuntu 22.04 LTS libstb No fix yet —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 20.04 LTS libstb No fix yet —
ReleasePackageFixed inAdvisory
Alpine v3.24 stb 0_git20231012-r0 —
Alpine v3.23 stb 0_git20231012-r0 —
Alpine v3.22 stb 0_git20231012-r0 —
Alpine v3.21 stb 0_git20231012-r0 —
Alpine v3.20 stb 0_git20231012-r0 —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 stb 0_git20231012-r0 —

References