Fix segmentation faults on ODROID-XU3/XU4 running GNU/Linux, and probably other 32-bit ARM devices like older Raspberry Pis

This commit is contained in:
Christian Angel 2023-10-19 17:13:09 -04:00
parent 684b016487
commit 44ac5ded31
1 changed files with 1 additions and 1 deletions

View File

@ -242,7 +242,7 @@ void *Z_Malloc2(size_t size, INT32 tag, void *user, INT32 alignbits,
void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits) void *Z_MallocAlign(size_t size, INT32 tag, void *user, INT32 alignbits)
#endif #endif
{ {
size_t extrabytes = (1<<alignbits) - 1; size_t extrabytes = (1<<alignbits) - (sizeof(size_t)*8 > (UINT32) alignbits); // only subtract 1 if the bit shift did not cause an overflow
size_t padsize = 0; size_t padsize = 0;
memblock_t *block; memblock_t *block;
void *ptr; void *ptr;