mirror of
https://github.com/AFLplusplus/AFLplusplus.git
synced 2025-06-15 19:38:09 +00:00
change map_size tests
This commit is contained in:
@ -1569,13 +1569,21 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
if (!afl->non_instrumented_mode && !afl->fsrv.qemu_mode &&
|
||||
!afl->unicorn_mode) {
|
||||
|
||||
afl->fsrv.map_size = 4194304; // dummy temporary value
|
||||
setenv("AFL_MAP_SIZE", "4194304", 1);
|
||||
u32 set_env = 0;
|
||||
if (!getenv("AFL_MAP_SIZE")) {
|
||||
|
||||
afl->fsrv.map_size = 8000000; // dummy temporary value
|
||||
setenv("AFL_MAP_SIZE", "8000000", 1);
|
||||
set_env = 1;
|
||||
|
||||
}
|
||||
|
||||
u32 prev_map_size = afl->fsrv.map_size;
|
||||
|
||||
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 != 4194304) {
|
||||
if (new_map_size && new_map_size != prev_map_size) {
|
||||
|
||||
// only reinitialize when it makes sense
|
||||
if (map_size < new_map_size ||
|
||||
@ -1607,6 +1615,7 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
}
|
||||
|
||||
map_size = new_map_size;
|
||||
if (set_env) { unsetenv("AFL_MAP_SIZE"); }
|
||||
|
||||
}
|
||||
|
||||
@ -1624,13 +1633,22 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
afl->cmplog_fsrv.cmplog_binary = afl->cmplog_binary;
|
||||
afl->cmplog_fsrv.init_child_func = cmplog_exec_child;
|
||||
|
||||
afl->cmplog_fsrv.map_size = 4194304;
|
||||
u32 set_env = 0;
|
||||
if (!getenv("AFL_MAP_SIZE")) {
|
||||
|
||||
afl->fsrv.map_size = 8000000; // dummy temporary value
|
||||
setenv("AFL_MAP_SIZE", "8000000", 1);
|
||||
set_env = 1;
|
||||
|
||||
}
|
||||
|
||||
u32 prev_map_size = afl->fsrv.map_size;
|
||||
|
||||
u32 new_map_size =
|
||||
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 != 4194304) {
|
||||
if (new_map_size && new_map_size != prev_map_size) {
|
||||
|
||||
// only reinitialize when it needs to be larger
|
||||
if (map_size < new_map_size) {
|
||||
@ -1667,6 +1685,8 @@ int main(int argc, char **argv_orig, char **envp) {
|
||||
|
||||
}
|
||||
|
||||
if (set_env) { unsetenv("AFL_MAP_SIZE"); }
|
||||
|
||||
}
|
||||
|
||||
afl->cmplog_fsrv.map_size = map_size;
|
||||
|
Reference in New Issue
Block a user