stb_image: Fix potential null deref in stbi_realloc()
This commit is contained in:
@@ -35,8 +35,8 @@
|
||||
+ 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)) - 16; \
|
||||
+ if (STBI_REALLOC_buf != NULL) { \
|
||||
+ size_t STBI_REALLOC_old_size = (*(size_t *)((void *)STBI_REALLOC_buf - 16)) - 16; \
|
||||
+ memcpy(STBI_REALLOC_new_buf, STBI_REALLOC_buf, \
|
||||
+ MIN(STBI_REALLOC_alloc_size, STBI_REALLOC_old_size)); \
|
||||
+ STBI_FREE(STBI_REALLOC_buf); \
|
||||
|
||||
Reference in New Issue
Block a user