about summary refs log tree commit diff
path: root/src/afl-fuzz-python.c
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2021-08-20 23:54:59 +0200
committerGitHub <noreply@github.com>2021-08-20 23:54:59 +0200
commit2e15661f184c77ac1fbb6f868c894e946cbb7f17 (patch)
tree665b9368d2c1908cf71dbc4a76517f88c5317d9a /src/afl-fuzz-python.c
parent32a0d6ac31554a47dca591f8978982758fb87677 (diff)
parentca9c87dd45d8b9a746a212cbc6ce85b78b637d8c (diff)
downloadafl++-2e15661f184c77ac1fbb6f868c894e946cbb7f17.tar.gz
Merge pull request #1074 from AFLplusplus/dev
push to stable
Diffstat (limited to 'src/afl-fuzz-python.c')
-rw-r--r--src/afl-fuzz-python.c24
1 files changed, 21 insertions, 3 deletions
diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c
index 3aa97635..065977c0 100644
--- a/src/afl-fuzz-python.c
+++ b/src/afl-fuzz-python.c
@@ -446,6 +446,10 @@ struct custom_mutator *load_custom_mutator_py(afl_state_t *afl,
   /* Initialize the custom mutator */
   init_py(afl, py_mutator, rand_below(afl, 0xFFFFFFFF));
 
+  mutator->stacked_custom = (mutator && mutator->afl_custom_havoc_mutation);
+  mutator->stacked_custom_prob =
+      6;  // like one of the default mutations in havoc
+
   return mutator;
 
 }
@@ -813,8 +817,8 @@ u8 queue_get_py(void *py_mutator, const u8 *filename) {
 
 }
 
-void queue_new_entry_py(void *py_mutator, const u8 *filename_new_queue,
-                        const u8 *filename_orig_queue) {
+u8 queue_new_entry_py(void *py_mutator, const u8 *filename_new_queue,
+                      const u8 *filename_orig_queue) {
 
   PyObject *py_args, *py_value;
 
@@ -861,7 +865,21 @@ void queue_new_entry_py(void *py_mutator, const u8 *filename_new_queue,
       py_args);
   Py_DECREF(py_args);
 
-  if (py_value == NULL) {
+  if (py_value != NULL) {
+
+    int ret = PyObject_IsTrue(py_value);
+    Py_DECREF(py_value);
+
+    if (ret == -1) {
+
+      PyErr_Print();
+      FATAL("Failed to convert return value");
+
+    }
+
+    return (u8)ret & 0xFF;
+
+  } else {
 
     PyErr_Print();
     FATAL("Call failed");