code format and not setting sanitizers if debug and settings present

This commit is contained in:
van Hauser
2021-01-21 17:15:14 +01:00
parent 43edd969d8
commit b850951c72
6 changed files with 44 additions and 39 deletions

View File

@ -484,6 +484,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
/* Set sane defaults for ASAN if nothing else specified. */ /* Set sane defaults for ASAN if nothing else specified. */
if (!afl->debug || !getenv("ASAN_OPTIONS"))
setenv("ASAN_OPTIONS", setenv("ASAN_OPTIONS",
"abort_on_error=1:" "abort_on_error=1:"
"detect_leaks=0:" "detect_leaks=0:"
@ -499,6 +500,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
/* Set sane defaults for UBSAN if nothing else specified. */ /* Set sane defaults for UBSAN if nothing else specified. */
if (!afl->debug || !getenv("UBSAN_OPTIONS"))
setenv("UBSAN_OPTIONS", setenv("UBSAN_OPTIONS",
"halt_on_error=1:" "halt_on_error=1:"
"abort_on_error=1:" "abort_on_error=1:"
@ -515,6 +517,7 @@ void afl_fsrv_start(afl_forkserver_t *fsrv, char **argv,
/* MSAN is tricky, because it doesn't support abort_on_error=1 at this /* MSAN is tricky, because it doesn't support abort_on_error=1 at this
point. So, we do this in a very hacky way. */ point. So, we do this in a very hacky way. */
if (!afl->debug || !getenv("MSAN_OPTIONS"))
setenv("MSAN_OPTIONS", setenv("MSAN_OPTIONS",
"exit_code=" STRINGIFY(MSAN_ERROR) ":" "exit_code=" STRINGIFY(MSAN_ERROR) ":"
"symbolize=0:" "symbolize=0:"

View File

@ -700,11 +700,7 @@ save_if_interesting(afl_state_t *afl, void *mem, u32 len, u8 fault) {
if (likely(!afl->non_instrumented_mode)) { if (likely(!afl->non_instrumented_mode)) {
if (!classified) { if (!classified) { classify_counts(&afl->fsrv); }
classify_counts(&afl->fsrv);
}
simplify_trace(afl, afl->fsrv.trace_bits); simplify_trace(afl, afl->fsrv.trace_bits);

View File

@ -60,8 +60,10 @@ void write_setup_file(afl_state_t *afl, u32 argc, char **argv) {
if (i) fprintf(f, " "); if (i) fprintf(f, " ");
#ifdef __ANDROID__ #ifdef __ANDROID__
if (memchr(argv[i], '\'', sizeof(argv[i]))) { if (memchr(argv[i], '\'', sizeof(argv[i]))) {
#else #else
if (index(argv[i], '\'')) { if (index(argv[i], '\'')) {
#endif #endif
fprintf(f, "'"); fprintf(f, "'");

View File

@ -123,7 +123,8 @@ static void usage(u8 *argv0, int more_help) {
"it.\n" "it.\n"
" if using QEMU, just use -c 0.\n" " if using QEMU, just use -c 0.\n"
" -l cmplog_level - set the complexity/intensivity of CmpLog.\n" " -l cmplog_level - set the complexity/intensivity of CmpLog.\n"
" Values: 1 (integer+string), 2 (+FP) and 3 (+transform)\n\n" " Values: 1 (integer+string), 2 (+FP) and 3 "
"(+transform)\n\n"
"Fuzzing behavior settings:\n" "Fuzzing behavior settings:\n"
" -Z - sequential queue selection instead of weighted " " -Z - sequential queue selection instead of weighted "
@ -584,7 +585,8 @@ int main(int argc, char **argv_orig, char **envp) {
if (afl->timeout_given) { FATAL("Multiple -t options not supported"); } if (afl->timeout_given) { FATAL("Multiple -t options not supported"); }
if (!optarg || sscanf(optarg, "%u%c", &afl->fsrv.exec_tmout, &suffix) < 1 || if (!optarg ||
sscanf(optarg, "%u%c", &afl->fsrv.exec_tmout, &suffix) < 1 ||
optarg[0] == '-') { optarg[0] == '-') {
FATAL("Bad syntax used for -t"); FATAL("Bad syntax used for -t");
@ -766,7 +768,8 @@ int main(int argc, char **argv_orig, char **envp) {
case 'V': { case 'V': {
afl->most_time_key = 1; afl->most_time_key = 1;
if (!optarg || sscanf(optarg, "%llu", &afl->most_time) < 1 || optarg[0] == '-') { if (!optarg || sscanf(optarg, "%llu", &afl->most_time) < 1 ||
optarg[0] == '-') {
FATAL("Bad syntax used for -V"); FATAL("Bad syntax used for -V");
@ -777,7 +780,8 @@ int main(int argc, char **argv_orig, char **envp) {
case 'E': { case 'E': {
afl->most_execs_key = 1; afl->most_execs_key = 1;
if (!optarg || sscanf(optarg, "%llu", &afl->most_execs) < 1 || optarg[0] == '-') { if (!optarg || sscanf(optarg, "%llu", &afl->most_execs) < 1 ||
optarg[0] == '-') {
FATAL("Bad syntax used for -E"); FATAL("Bad syntax used for -E");