:: commit 08ed65f63e40c0c9f89d7ab64205f7e545a0aab0

Mintsuki <mintsuki@protonmail.com> — 2025-04-12 18:18

parents: 15b57fb7c4

stb_image: Fix calculation of old size in stbi_realloc()

diff --git a/common/stb_image.patch b/common/stb_image.patch
index 87f6f719..33171d06 100644
--- a/common/stb_image.patch
+++ b/common/stb_image.patch
@@ -35,7 +35,7 @@
 +    void *STBI_REALLOC_buf = (x); \
 +    size_t STBI_REALLOC_alloc_size = (y); \
 +    void *STBI_REALLOC_new_buf = STBI_MALLOC(STBI_REALLOC_alloc_size); \
-+    size_t STBI_REALLOC_old_size = *(size_t *)((void *)STBI_REALLOC_buf - 16); \
++    size_t STBI_REALLOC_old_size = (*(size_t *)((void *)STBI_REALLOC_buf - 16)) - 16; \
 +    if (STBI_REALLOC_buf != NULL) { \
 +        memcpy(STBI_REALLOC_new_buf, STBI_REALLOC_buf, \
 +               MIN(STBI_REALLOC_alloc_size, STBI_REALLOC_old_size)); \
tab: 248 wrap: offon