new auto map

This commit is contained in:
aflpp
2021-03-11 09:32:22 +01:00
parent adeb0d18b1
commit b7d90a9e31

View File

@ -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;
}