aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-08-24 18:06:07 +0200
committervan Hauser <vh@thc.org>2020-08-24 18:06:07 +0200
commit6a34c5aa3e0a1da06a5268ecabfc92ab36ce96dc (patch)
tree0e770e13df70dbeda16cfca2141ddf5e4a2d59a0
parentc7f0d3066875bca0ec28e9429df40293339dc05c (diff)
downloadafl++-6a34c5aa3e0a1da06a5268ecabfc92ab36ce96dc.tar.gz
fix python implementation for new function
-rw-r--r--include/afl-fuzz.h2
-rw-r--r--src/afl-fuzz-python.c3
2 files changed, 3 insertions, 2 deletions
diff --git a/include/afl-fuzz.h b/include/afl-fuzz.h
index 01aa1a73..91915bf6 100644
--- a/include/afl-fuzz.h
+++ b/include/afl-fuzz.h
@@ -288,7 +288,6 @@ enum {
enum {
/* 00 */ PY_FUNC_INIT,
- /* 01 */ PY_FUNC_FUZZ_COUNT,
/* 01 */ PY_FUNC_FUZZ,
/* 02 */ PY_FUNC_POST_PROCESS,
/* 03 */ PY_FUNC_INIT_TRIM,
@@ -299,6 +298,7 @@ enum {
/* 08 */ PY_FUNC_QUEUE_GET,
/* 09 */ PY_FUNC_QUEUE_NEW_ENTRY,
/* 10 */ PY_FUNC_DEINIT,
+ /* 11 */ PY_FUNC_FUZZ_COUNT,
PY_FUNC_COUNT
};
diff --git a/src/afl-fuzz-python.c b/src/afl-fuzz-python.c
index 68540dd7..32c8ac89 100644
--- a/src/afl-fuzz-python.c
+++ b/src/afl-fuzz-python.c
@@ -144,6 +144,7 @@ static py_mutator_t *init_py_module(afl_state_t *afl, u8 *module_name) {
py_functions[PY_FUNC_FUZZ] = PyObject_GetAttrString(py_module, "fuzz");
if (!py_functions[PY_FUNC_FUZZ])
py_functions[PY_FUNC_FUZZ] = PyObject_GetAttrString(py_module, "mutate");
+ py_functions[PY_FUNC_FUZZ_COUNT] = PyObject_GetAttrString(py_module, "fuzz_count");
if (!py_functions[PY_FUNC_FUZZ])
WARNF("fuzz function not found in python module");
py_functions[PY_FUNC_POST_PROCESS] =
@@ -187,7 +188,7 @@ static py_mutator_t *init_py_module(afl_state_t *afl, u8 *module_name) {
// Implenting the havoc and queue API is optional for now
if (PyErr_Occurred()) { PyErr_Print(); }
- } else {
+ } else if (py_idx != PY_FUNC_FUZZ_COUNT) {
if (PyErr_Occurred()) { PyErr_Print(); }
fprintf(stderr,