aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2022-08-15 19:22:46 +0200
committervanhauser-thc <vh@thc.org>2022-08-15 19:22:46 +0200
commit2462c61df9cffa5e29433913a73095d212b70403 (patch)
treed0ba56b3766acf6d3ada8df59aab42d7bb4fb7d3
parentba14c353c07d19ad37916947708a9c26537c6d62 (diff)
downloadafl++-2462c61df9cffa5e29433913a73095d212b70403.tar.gz
fix new map size extraction for afl-gcc
-rwxr-xr-xafl-cmin15
-rwxr-xr-xafl-cmin.bash11
2 files changed, 15 insertions, 11 deletions
diff --git a/afl-cmin b/afl-cmin
index 44716af1..4e0d78df 100755
--- a/afl-cmin
+++ b/afl-cmin
@@ -291,13 +291,14 @@ BEGIN {
target_bin = tnew
}
- get_map_size = "AFL_DUMP_MAP_SIZE=1 " target_bin
- get_map_size | getline mapsize
- if (mapsize && mapsize > 65535) {
-
- AFL_MAP_SIZE = "AFL_MAP_SIZE="mapsize" "
- print "[+] Setting "AFL_MAP_SIZE
-
+ if (0 == system ( "grep -aq AFL_DUMP_MAP_SIZE" target_bin )) {
+ echo "[!] Trying to obtain the map size of the target ..."
+ get_map_size = "AFL_DUMP_MAP_SIZE=1 " target_bin
+ get_map_size | getline mapsize
+ if (mapsize && mapsize > 65535 && mapsize < 100000000) {
+ AFL_MAP_SIZE = "AFL_MAP_SIZE="mapsize" "
+ print "[+] Setting "AFL_MAP_SIZE
+ }
}
if (!ENVIRON["AFL_SKIP_BIN_CHECK"] && !qemu_mode && !frida_mode && !unicorn_mode) {
diff --git a/afl-cmin.bash b/afl-cmin.bash
index db3e8ae5..d2218cd0 100755
--- a/afl-cmin.bash
+++ b/afl-cmin.bash
@@ -215,10 +215,13 @@ if [ ! -f "$TARGET_BIN" -o ! -x "$TARGET_BIN" ]; then
fi
-MAPSIZE=`AFL_DUMP_MAP_SIZE=1 "./$TARGET_BIN" 2>/dev/null`
-test -n "$MAPSIZE" && {
- export AFL_MAP_SIZE=$MAPSIZE
- echo "[+] Setting AFL_MAP_SIZE=$MAPSIZE"
+grep -aq AFL_DUMP_MAP_SIZE "./$TARGET_BIN" && {
+ echo "[!] Trying to obtain the map size of the target ..."
+ MAPSIZE=`AFL_DUMP_MAP_SIZE=1 "./$TARGET_BIN" 2>/dev/null`
+ test -n "$MAPSIZE" && {
+ export AFL_MAP_SIZE=$MAPSIZE
+ echo "[+] Setting AFL_MAP_SIZE=$MAPSIZE"
+ }
}
if [ "$AFL_SKIP_BIN_CHECK" = "" -a "$QEMU_MODE" = "" -a "$FRIDA_MODE" = "" -a "$UNICORN_MODE" = "" ]; then