diff options
author | hexcoder- <heiko@hexco.de> | 2019-10-23 14:53:05 +0200 |
---|---|---|
committer | hexcoder- <heiko@hexco.de> | 2019-10-23 14:53:05 +0200 |
commit | b9bc81544a438868529fbe040f4734256dce7a1d (patch) | |
tree | 647677e44a60f3aac12152121c64a05a04e0ac1e | |
parent | 7d9eed0ed5a57f16b15fe2576da4aec79e0909c9 (diff) | |
download | afl++-b9bc81544a438868529fbe040f4734256dce7a1d.tar.gz |
debugged and fixed libdislocator malfunction on MacOSX
-rw-r--r-- | libdislocator/libdislocator.so.c | 4 | ||||
-rwxr-xr-x | test/test.sh | 4 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libdislocator/libdislocator.so.c b/libdislocator/libdislocator.so.c index f3f02c8b..7f44071a 100644 --- a/libdislocator/libdislocator.so.c +++ b/libdislocator/libdislocator.so.c @@ -88,7 +88,7 @@ static u8 alloc_verbose, /* Additional debug messages */ hard_fail, /* abort() when max_mem exceeded? */ no_calloc_over; /* abort() on calloc() overflows? */ -#ifdef __OpenBSD__ +#if defined __OpenBSD__ || defined __APPLE__ #define __thread #warning no thread support available #endif @@ -121,7 +121,7 @@ static void* __dislocator_alloc(size_t len) { ret = mmap(NULL, (1 + PG_COUNT(len + 8)) * PAGE_SIZE, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); - if (ret == (void*)-1) { + if (ret == MAP_FAILED) { if (hard_fail) FATAL("mmap() failed on alloc (OOM?)"); diff --git a/test/test.sh b/test/test.sh index d1be014f..598fb502 100755 --- a/test/test.sh +++ b/test/test.sh @@ -281,8 +281,8 @@ test -e ../libtokencap.so && { test -e ../libdislocator.so && { { ulimit -c 1 - # DYLD_INSERT_LIBRARIES is used on Darwin/MacOSX - LD_PRELOAD=../libdislocator.so DYLD_INSERT_LIBRARIES=../libdislocator.so ./test-compcov BUFFEROVERFLOW > test.out 2> /dev/null + # DYLD_INSERT_LIBRARIES and DYLD_FORCE_FLAT_NAMESPACE is used on Darwin/MacOSX + LD_PRELOAD=../libdislocator.so DYLD_INSERT_LIBRARIES=../libdislocator.so DYLD_FORCE_FLAT_NAMESPACE=1 ./test-compcov BUFFEROVERFLOW > test.out 2> /dev/null } > /dev/null 2>&1 grep -q BUFFEROVERFLOW test.out > /dev/null 2>&1 && { $ECHO "$RED[!] libdislocator did not detect the memory corruption" |