fix possible crash due to something modifying the 4 bytes between the sizecheck header and the actual allocated data on 64-bit

develop
Ben Lubar 2020-02-14 17:38:18 -06:00
parent 136accdd64
commit 360e6e9afb
No known key found for this signature in database
GPG Key ID: 92939677AB59EDA4
1 changed files with 1 additions and 1 deletions

@ -24,7 +24,7 @@ void* alloc(size_t n) {
}
void dealloc(void* addr) {
if (intptr_t(addr) % 32 == 16 && *(size_t*)((uint8_t*)addr - 8) == MAGIC) {
if (uintptr_t(addr) % 32 == 16 && *(uint32_t*)((uint8_t*)addr - 8) == MAGIC) {
addr = (void*)((uint8_t*)addr - 16);
}
free(addr);