about summary refs log tree commit diff
path: root/src/afl-fuzz-python.c
diff options
context:
space:
mode:
authorvanhauser-thc <vh@thc.org>2021-07-09 10:32:14 +0200
committervanhauser-thc <vh@thc.org>2021-07-09 10:32:14 +0200
commite1d5009229fb5cea5845cd08e0abdc8fe440ee86 (patch)
tree5855fd6e27d83b5d7eb2c455a8bb3bc7b43403a4 /src/afl-fuzz-python.c
parentfd4acc935efe78a340395ca386b856930f7e6b22 (diff)
downloadafl++-e1d5009229fb5cea5845cd08e0abdc8fe440ee86.tar.gz
fixes
Diffstat (limited to 'src/afl-fuzz-python.c')
-rw-r--r--src/afl-fuzz-python.c20
1 files changed, 17 insertions, 3 deletions
diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c
index 3aa97635..bb4eabcc 100644
--- a/src/afl-fuzz-python.c
+++ b/src/afl-fuzz-python.c
@@ -813,8 +813,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 +861,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");