aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2023-01-18 23:16:18 +0100
committervanhauser-thc <vh@thc.org>2023-01-18 23:16:18 +0100
commit151a8facae2048a26c65658dfec507233a677fb0 (patch)
tree529c88447b07d2516ed2f93c74942697468d456f
parent45567791c66e128361a7533481b385497ced881f (diff)
downloadafl++-151a8facae2048a26c65658dfec507233a677fb0.tar.gz
autotokens: stats
-rw-r--r--custom_mutators/autotokens/autotokens.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/custom_mutators/autotokens/autotokens.cpp b/custom_mutators/autotokens/autotokens.cpp
index f6ab9ddd..4f3289c9 100644
--- a/custom_mutators/autotokens/autotokens.cpp
+++ b/custom_mutators/autotokens/autotokens.cpp
@@ -22,7 +22,9 @@ extern "C" {
#define AUTOTOKENS_SIZE_MIN 8
#define AUTOTOKENS_SPLICE_MIN 4
#define AUTOTOKENS_SPLICE_MAX 64
-#define AUTOTOKENS_SPLICE_DISABLE 0
+#ifndef AUTOTOKENS_SPLICE_DISABLE
+ #define AUTOTOKENS_SPLICE_DISABLE 0
+#endif
#if AUTOTOKENS_SPLICE_MIN >= AUTOTOKENS_SIZE_MIN
#error SPLICE_MIN must be lower than SIZE_MIN
@@ -49,6 +51,7 @@ static u32 whitespace_ids;
static u32 extras_cnt, a_extras_cnt;
static u64 all_spaces, all_tabs, all_lf, all_ws;
static u64 all_structure_items;
+static u64 fuzz_count;
static unordered_map<string, vector<u32> *> file_mapping;
static unordered_map<u32, vector<u32> *> id_mapping;
static unordered_map<string, u32> token_to_id;
@@ -238,6 +241,7 @@ extern "C" size_t afl_custom_fuzz(my_mutator_t *data, u8 *buf, size_t buf_size,
break;
}
+
#endif
/* ERASE - only if large enough */
@@ -298,6 +302,7 @@ extern "C" size_t afl_custom_fuzz(my_mutator_t *data, u8 *buf, size_t buf_size,
memcpy(mutated_out, output.data(), mutated_size);
*out_buf = mutated_out;
+ ++fuzz_count;
return mutated_size;
}
@@ -997,8 +1002,9 @@ extern "C" void afl_custom_deinit(my_mutator_t *data) {
"\n\nAutotoken mutator statistics:\n"
" Number of all seen tokens: %u\n"
" Number of input structures: %u\n"
- " Number of all items in structures: %llu\n\n",
- current_id - 1, valid_structures, all_structure_items);
+ " Number of all items in structures: %llu\n"
+ " Number of total fuzzes: %llu\n\n",
+ current_id - 1, valid_structures, all_structure_items, fuzz_count);
free(data);