Repository navigation
afl persistent mode #2012
Copy link
Copy link
Closed
Labels
kind: bugstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated
Description
Activity
@GrosQuildu Thanks for reporting.
I created a branch https://github.com/nlohmann/json/tree/feature/afl_persistent with your proposed change. I had to make some changes to make it compile via
make fuzz_testingThen, I get the following warning on
(odd, check syntax!):Any ideas?
Sorry for the questions - since the project is fuzz tested by OSSFuzz, I have not executed AFL regularly.
__AFL_HAVE_MANUAL_CONTROLis defined only withafl-clang-fast, not withafl-clangnorafl-gcc. Fix like:#include <vector> // for vector #include <cstdint> // for uint8_t #include <iostream> // for cin #include <cstring> // for memcpy #include <unistd.h> // for read extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size); static const std::size_t MaxInputSize = 1048576; // 1MiB static uint8_t InputBuf[MaxInputSize]; int main() { #ifdef __AFL_HAVE_MANUAL_CONTROL /* AFL deferred fork */ __AFL_INIT(); /* AFL persistent loop */ while (__AFL_LOOP(1000)) { #endif /* read data*/ ssize_t bytesReadedS = read(0, InputBuf, MaxInputSize); if (bytesReadedS > 0) { size_t bytesReaded = static_cast<size_t>(bytesReadedS); /* allocate memory, exactly bytesReaded to catch overflows */ uint8_t* tmpBuf = static_cast<uint8_t*>(malloc(bytesReaded)); memcpy(tmpBuf, InputBuf, bytesReaded); /* run harness*/ LLVMFuzzerTestOneInput(tmpBuf, bytesReaded); /* clear */ free(tmpBuf); } #ifdef __AFL_HAVE_MANUAL_CONTROL } #endif return 0; }
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
- addedstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated
on May 24, 2020
Metadata
Metadata
Assignees
Labels
kind: bugstate: stalethe issue has not been updated in a while and will be closed automatically soon unless it is updatedthe issue has not been updated in a while and will be closed automatically soon unless it is updated

AFL's persistent mode (
__AFL_LOOP(1000)) has very poor stability (around 5%).Environment:
AFL is AFL++ from master.
It may be due to the invalid usage of
cin.get, but not sure about that. Replacing file withtest/src/fuzzer-driver_afl.cpp:yields 100% stability (performance is about the same).