aboutsummaryrefslogtreecommitdiff
path: root/examples/custom_mutators
diff options
context:
space:
mode:
authorrish9101 <rranjan@cs.iitr.ac.in>2020-05-13 18:59:12 +0530
committerrish9101 <rranjan@cs.iitr.ac.in>2020-05-13 18:59:12 +0530
commit9627458ecc61783aa1f8bf76835abe00c4107739 (patch)
treed489774c83c2e24faf9c44fcde3eb21990679891 /examples/custom_mutators
parentf8b3d34225102158ed585130e3de08772e989b53 (diff)
downloadafl++-9627458ecc61783aa1f8bf76835abe00c4107739.tar.gz
Add post library API as custom mutator and rename pre_save
Diffstat (limited to 'examples/custom_mutators')
-rw-r--r--examples/custom_mutators/example.c24
-rw-r--r--examples/custom_mutators/example.py2
2 files changed, 13 insertions, 13 deletions
diff --git a/examples/custom_mutators/example.c b/examples/custom_mutators/example.c
index c8200b26..c9be3e0c 100644
--- a/examples/custom_mutators/example.c
+++ b/examples/custom_mutators/example.c
@@ -38,7 +38,7 @@ typedef struct my_mutator {
BUF_VAR(u8, data);
BUF_VAR(u8, havoc);
BUF_VAR(u8, trim);
- BUF_VAR(u8, pre_save);
+ BUF_VAR(u8, post_process);
} my_mutator_t;
@@ -139,11 +139,11 @@ size_t afl_custom_fuzz(my_mutator_t *data, uint8_t *buf, size_t buf_size,
* @return Size of the output buffer after processing or the needed amount.
* A return of 0 indicates an error.
*/
-size_t afl_custom_pre_save(my_mutator_t *data, uint8_t *buf, size_t buf_size,
+size_t afl_custom_post_process(my_mutator_t *data, uint8_t *buf, size_t buf_size,
uint8_t **out_buf) {
- uint8_t *pre_save_buf = maybe_grow(BUF_PARAMS(data, pre_save), buf_size + 5);
- if (!pre_save_buf) {
+ uint8_t *post_process_buf = maybe_grow(BUF_PARAMS(data, post_process), buf_size + 5);
+ if (!post_process_buf) {
perror("custom mutator realloc failed.");
*out_buf = NULL;
@@ -151,14 +151,14 @@ size_t afl_custom_pre_save(my_mutator_t *data, uint8_t *buf, size_t buf_size,
}
- memcpy(pre_save_buf + 5, buf, buf_size);
- pre_save_buf[0] = 'A';
- pre_save_buf[1] = 'F';
- pre_save_buf[2] = 'L';
- pre_save_buf[3] = '+';
- pre_save_buf[4] = '+';
+ memcpy(post_process_buf + 5, buf, buf_size);
+ post_process_buf[0] = 'A';
+ post_process_buf[1] = 'F';
+ post_process_buf[2] = 'L';
+ post_process_buf[3] = '+';
+ post_process_buf[4] = '+';
- *out_buf = pre_save_buf;
+ *out_buf = post_process_buf;
return buf_size + 5;
@@ -364,7 +364,7 @@ void afl_custom_queue_new_entry(my_mutator_t * data,
*/
void afl_custom_deinit(my_mutator_t *data) {
- free(data->pre_save_buf);
+ free(data->post_process_buf);
free(data->havoc_buf);
free(data->data_buf);
free(data->fuzz_buf);
diff --git a/examples/custom_mutators/example.py b/examples/custom_mutators/example.py
index 3c3fa8c1..cf659e5a 100644
--- a/examples/custom_mutators/example.py
+++ b/examples/custom_mutators/example.py
@@ -120,7 +120,7 @@ def fuzz(buf, add_buf, max_size):
#
# return next_index
#
-# def pre_save(buf):
+# def post_process(buf):
# '''
# Called just before the execution to write the test case in the format
# expected by the target