aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2022-09-26 11:55:03 +0200
committervanhauser-thc <vh@thc.org>2022-09-26 11:55:03 +0200
commit1ce0dcac3fc8580d549143dc0e8469264900bdce (patch)
treecce55648d1e161100e8cf5456990bd3c8dff0caf
parent77f253c1b910e5240ac467680ea9e21a1e4e05ef (diff)
downloadafl++-1ce0dcac3fc8580d549143dc0e8469264900bdce.tar.gz
fix standalone running with shared libs
-rw-r--r--docs/Changelog.md4
-rw-r--r--instrumentation/afl-compiler-rt.o.c22
2 files changed, 16 insertions, 10 deletions
diff --git a/docs/Changelog.md b/docs/Changelog.md
index 2b67fb76..32272b8e 100644
--- a/docs/Changelog.md
+++ b/docs/Changelog.md
@@ -5,7 +5,9 @@
### Version ++4.04a (dev)
- - ... your PR? :)
+ - fix gramatron and grammar_mutatur build scripts
+ - afl-cc:
+ - make gcc_mode (afl-gcc-fast) work with gcc down to version 3.6
### Version ++4.03c (release)
diff --git a/instrumentation/afl-compiler-rt.o.c b/instrumentation/afl-compiler-rt.o.c
index 1759898e..84ad57fa 100644
--- a/instrumentation/afl-compiler-rt.o.c
+++ b/instrumentation/afl-compiler-rt.o.c
@@ -348,7 +348,7 @@ static void __afl_map_shm(void) {
u32 val = 0;
u8 *ptr;
- if ((ptr = getenv("AFL_MAP_SIZE")) != NULL) val = atoi(ptr);
+ if ((ptr = getenv("AFL_MAP_SIZE")) != NULL) { val = atoi(ptr); }
if (val > MAP_INITIAL_SIZE) {
@@ -1375,17 +1375,17 @@ __attribute__((constructor(1))) void __afl_auto_second(void) {
if (getenv("AFL_DISABLE_LLVM_INSTRUMENTATION")) return;
u8 *ptr;
- if (__afl_final_loc) {
+ if (__afl_final_loc > MAP_INITIAL_SIZE) {
if (__afl_area_ptr && __afl_area_ptr != __afl_area_initial)
free(__afl_area_ptr);
if (__afl_map_addr)
- ptr = (u8 *)mmap((void *)__afl_map_addr, __afl_final_loc,
+ ptr = (u8 *)mmap((void *)__afl_map_addr, __afl_final_loc + 2,
PROT_READ | PROT_WRITE,
MAP_FIXED_NOREPLACE | MAP_SHARED | MAP_ANONYMOUS, -1, 0);
else
- ptr = (u8 *)malloc(__afl_final_loc);
+ ptr = (u8 *)malloc(__afl_final_loc + 2);
if (ptr && (ssize_t)ptr != -1) {
@@ -1407,14 +1407,18 @@ __attribute__((constructor(0))) void __afl_auto_first(void) {
__afl_already_initialized_first = 1;
if (getenv("AFL_DISABLE_LLVM_INSTRUMENTATION")) return;
- u8 *ptr = (u8 *)malloc(MAP_INITIAL_SIZE);
- if (ptr && (ssize_t)ptr != -1) {
+ /*
+ u8 *ptr = (u8 *)malloc(MAP_INITIAL_SIZE);
- __afl_area_ptr = ptr;
- __afl_area_ptr_backup = __afl_area_ptr;
+ if (ptr && (ssize_t)ptr != -1) {
- }
+ __afl_area_ptr = ptr;
+ __afl_area_ptr_backup = __afl_area_ptr;
+
+ }
+
+ */
} // ptr memleak report is a false positive