diff --git a/src/tests/fuzz/onefile.c b/src/tests/fuzz/onefile.c index 8ea7ac907d..e5d34ab182 100644 --- a/src/tests/fuzz/onefile.c +++ b/src/tests/fuzz/onefile.c @@ -1,6 +1,7 @@ #include #include #include +#include "config.h" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size); @@ -13,6 +14,10 @@ int main(int argc, char** argv) if (argc != 2) { return 1; } +#ifdef AFLFUZZ_PERSISTANT_MODE + while (__AFL_LOOP(1000)) { +#endif /* AFLFUZZ_PERSISTANT_MODE */ + //opens the file, get its size, and reads it into a buffer fp = fopen(argv[1], "rb"); if (fp == NULL) { @@ -46,5 +51,10 @@ int main(int argc, char** argv) LLVMFuzzerTestOneInput(data, size); free(data); fclose(fp); +#ifdef AFLFUZZ_PERSISTANT_MODE + } +#endif /* AFLFUZZ_PERSISTANT_MODE */ + return 0; } +