new auto map
MODIFY
src/afl-fuzz.c
src/afl-fuzz.c
@@ -1595,11 +1595,10 @@ int main(int argc, char **argv_orig, char **envp) {
u32 new_map_size = afl_fsrv_get_mapsize(
&afl->fsrv, afl->argv, &afl->stop_soon, afl->afl_env.afl_debug_child);
- if (new_map_size && new_map_size != map_size) {
-
// only reinitialize when it makes sense
if (map_size < new_map_size ||
- (new_map_size > map_size && new_map_size - map_size > MAP_SIZE)) {
+ (!afl->cmplog_binary && new_map_size < map_size &&
+ map_size - new_map_size > MAP_SIZE)) {
OKF("Re-initializing maps to %u bytes", new_map_size);
@@ -1624,18 +1623,14 @@ int main(int argc, char **argv_orig, char **envp) {
afl_fsrv_start(&afl->fsrv, afl->argv, &afl->stop_soon,
afl->afl_env.afl_debug_child);
- }
-
map_size = new_map_size;
- } else {
+ }
afl->fsrv.map_size = map_size;
}
- }
-
if (afl->cmplog_binary) {
ACTF("Spawning cmplog forkserver");
@@ -1658,10 +1653,9 @@ int main(int argc, char **argv_orig, char **envp) {
afl_fsrv_get_mapsize(&afl->cmplog_fsrv, afl->argv, &afl->stop_soon,
afl->afl_env.afl_debug_child);
- if (new_map_size && new_map_size != map_size) {
-
// only reinitialize when it needs to be larger
- if (map_size < new_map_size) {
+ if (map_size < new_map_size ||
+ (new_map_size < map_size && map_size - new_map_size > MAP_SIZE)) {
OKF("Re-initializing maps to %u bytes due cmplog", new_map_size);
@@ -1691,8 +1685,6 @@ int main(int argc, char **argv_orig, char **envp) {
afl_fsrv_start(&afl->cmplog_fsrv, afl->argv, &afl->stop_soon,
afl->afl_env.afl_debug_child);
- }
-
map_size = new_map_size;
}

new auto map