diff --git a/CHANGELOG.md b/CHANGELOG.md index 1715d0120..ec15e6721 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## `3.0.0` - Add support for LE 64-bit in isgenq.c (#422). +- Bugfix: IARV64 results must be checked for 0x7FFFF000 (#474) ## `2.17.0` - Fixed `xplatform.loadFileUTF8` when trying to open nonexistent file (#454) diff --git a/c/alloc.c b/c/alloc.c index 33742901a..b75b2fecf 100644 --- a/c/alloc.c +++ b/c/alloc.c @@ -181,7 +181,12 @@ static char* __ptr64 getmain64(long long sizeInMegabytes, int *returnCode, int * if (returnCode) *returnCode = macroRetCode; if (reasonCode) *reasonCode = macroResCode; - + + // IARV64 returns 0x7FFFF000 when MEMLIMIT is reached + if (data == (void *)0x7FFFF000) { + data = NULL; + } + return data; } @@ -202,7 +207,12 @@ static char* __ptr64 getmain64ByToken(long long sizeInMegabytes, long long token if (returnCode) *returnCode = macroRetCode; if (reasonCode) *reasonCode = macroResCode; - + + // IARV64 returns 0x7FFFF000 when MEMLIMIT is reached + if (data == (void *)0x7FFFF000) { + data = NULL; + } + return data; }