diff options
Diffstat (limited to 'compiler-rt/lib/fuzzer/dataflow/DataFlow.cpp')
-rw-r--r-- | compiler-rt/lib/fuzzer/dataflow/DataFlow.cpp | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler-rt/lib/fuzzer/dataflow/DataFlow.cpp b/compiler-rt/lib/fuzzer/dataflow/DataFlow.cpp index 99863074d72..a79c796ac45 100644 --- a/compiler-rt/lib/fuzzer/dataflow/DataFlow.cpp +++ b/compiler-rt/lib/fuzzer/dataflow/DataFlow.cpp @@ -69,6 +69,7 @@ static const uintptr_t *FuncsBeg; static __thread size_t CurrentFunc; static dfsan_label *FuncLabels; // Array of NumFuncs elements. static char *PrintableStringForLabel; // InputLen + 2 bytes. +static bool LabelSeen[1 << 8 * sizeof(dfsan_label)]; // Prints all instrumented functions. static int PrintFunctions() { @@ -89,7 +90,11 @@ static int PrintFunctions() { return 0; } -static void SetBytesForLabel(dfsan_label L, char *Bytes) { +extern "C" +void SetBytesForLabel(dfsan_label L, char *Bytes) { + if (LabelSeen[L]) + return; + LabelSeen[L] = true; assert(L); if (L <= InputLen + 1) { Bytes[L - 1] = '1'; @@ -103,6 +108,7 @@ static void SetBytesForLabel(dfsan_label L, char *Bytes) { static char *GetPrintableStringForLabel(dfsan_label L) { memset(PrintableStringForLabel, '0', InputLen + 1); PrintableStringForLabel[InputLen + 1] = 0; + memset(LabelSeen, 0, sizeof(LabelSeen)); SetBytesForLabel(L, PrintableStringForLabel); return PrintableStringForLabel; } |