mirror of
https://github.com/LuaJIT/LuaJIT.git
synced 2025-04-20 14:03:26 +00:00
Fix memory probing allocator to check for valid end address, too.
This commit is contained in:
parent
26f1023819
commit
646148e747
@ -255,7 +255,8 @@ static void *mmap_probe(size_t size)
|
|||||||
for (retry = 0; retry < LJ_ALLOC_MMAP_PROBE_MAX; retry++) {
|
for (retry = 0; retry < LJ_ALLOC_MMAP_PROBE_MAX; retry++) {
|
||||||
void *p = mmap((void *)hint_addr, size, MMAP_PROT, MMAP_FLAGS_PROBE, -1, 0);
|
void *p = mmap((void *)hint_addr, size, MMAP_PROT, MMAP_FLAGS_PROBE, -1, 0);
|
||||||
uintptr_t addr = (uintptr_t)p;
|
uintptr_t addr = (uintptr_t)p;
|
||||||
if ((addr >> LJ_ALLOC_MBITS) == 0 && addr >= LJ_ALLOC_MMAP_PROBE_LOWER) {
|
if ((addr >> LJ_ALLOC_MBITS) == 0 && addr >= LJ_ALLOC_MMAP_PROBE_LOWER &&
|
||||||
|
((addr + size) >> LJ_ALLOC_MBITS) == 0) {
|
||||||
/* We got a suitable address. Bump the hint address. */
|
/* We got a suitable address. Bump the hint address. */
|
||||||
hint_addr = addr + size;
|
hint_addr = addr + size;
|
||||||
errno = olderr;
|
errno = olderr;
|
||||||
|
Loading…
Reference in New Issue
Block a user