fix silent truncation of requested memory amount in 32-bit builds

This commit is contained in:
dzaima 2024-10-09 03:26:55 +03:00
parent d640931c02
commit 72e46f24bd

View File

@ -68,6 +68,7 @@ static NOINLINE void* BN(allocateMore)(ux bucket, u8 type, ux from, ux to) {
u8* mem = calloc(reqsz, 1);
if (mem_log_enabled) fprintf(stderr, "\n");
#else
if (reqsz != (size_t) reqsz) thrOOM(); // otherwise it gets silently truncated in 32-bit builds
u8* mem = MMAP(reqsz);
if (mem_log_enabled) fprintf(stderr, ": %s\n", mem==MAP_FAILED? "failed" : "success");
if (mem==MAP_FAILED) thrOOM();