diff --git a/src/include/deepstate/Log.h b/src/include/deepstate/Log.h index 9fb6e14..107cd9f 100644 --- a/src/include/deepstate/Log.h +++ b/src/include/deepstate/Log.h @@ -23,6 +23,8 @@ DEEPSTATE_BEGIN_EXTERN_C +extern int DeepState_UsingLibFuzzer; + struct DeepState_Stream; struct DeepState_VarArgs { diff --git a/src/lib/DeepState.c b/src/lib/DeepState.c index 70c6d60..3096fb5 100644 --- a/src/lib/DeepState.c +++ b/src/lib/DeepState.c @@ -549,8 +549,8 @@ extern int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) { return 0; // Just ignore any too-big inputs } - printf("LLVM fuzzing with input of size %ul\n", Size); - + DeepState_UsingLibFuzzer = 1; + struct DeepState_TestInfo *test = NULL; DeepState_InitOptions(0, ""); diff --git a/src/lib/Log.c b/src/lib/Log.c index c027ac6..dca7cb2 100644 --- a/src/lib/Log.c +++ b/src/lib/Log.c @@ -64,6 +64,8 @@ enum { DeepState_LogBufSize = 4096 }; +int DeepState_UsingLibFuzzer = 0; + char DeepState_LogBuf[DeepState_LogBufSize + 1] = {}; /* Log a C string. */ @@ -144,7 +146,17 @@ int __vprintf_chk(int flag, const char *format, va_list args) { DEEPSTATE_NOINLINE int vfprintf(FILE *file, const char *format, va_list args) { - if (stderr == file) { + if (DeepState_UsingLibFuzzer) { + if (stderr == file) { + // Silence DeepState output + // DeepState_LogVFormat(DeepState_LogDebug, format, args); + } else if (stdout == file) { + // Silence DeepState output + // DeepState_LogVFormat(DeepState_LogInfo, format, args); + } else { + DeepState_LogVFormat(DeepState_LogInfo, format, args); + } + } else if (stderr == file) { DeepState_LogVFormat(DeepState_LogDebug, format, args); } else if (stdout == file) { DeepState_LogVFormat(DeepState_LogInfo, format, args);