diff options
author | van Hauser <vh@thc.org> | 2021-07-20 08:57:37 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-20 08:57:37 +0200 |
commit | fff8c49f7c73a1531166ad52fc50306dbd01775f (patch) | |
tree | 217b85dfd5b6ccf62a8fa4ac59a65d615a08143f /src/afl-fuzz-python.c | |
parent | b3fe3b8877931f7ba7c4150fcc24e8cd18835d86 (diff) | |
parent | 5bcbb2f59affc411a1e8bb7ccaabaa5ba63e6596 (diff) | |
download | afl++-fff8c49f7c73a1531166ad52fc50306dbd01775f.tar.gz |
Merge pull request #1034 from AFLplusplus/grammatron
Grammatron
Diffstat (limited to 'src/afl-fuzz-python.c')
-rw-r--r-- | src/afl-fuzz-python.c | 20 |
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"); |