[compiler-rt] 67f5b05 - Add test for Flags.data_flow_trace
Vitaly Buka via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 7 22:18:42 PST 2023
Author: Wu, Yingcong
Date: 2023-03-07T22:18:29-08:00
New Revision: 67f5b05cdcdceb270e6cb9e2bf363bf66fd19979
URL: https://github.com/llvm/llvm-project/commit/67f5b05cdcdceb270e6cb9e2bf363bf66fd19979
DIFF: https://github.com/llvm/llvm-project/commit/67f5b05cdcdceb270e6cb9e2bf363bf66fd19979.diff
LOG: Add test for Flags.data_flow_trace
`CollectDataFlow()` uses `Flags.collect_data_flow` and
`Flags.data_flow_trace` at the same time. But in the null check before
the invocation, only `Flags.collect_data_flow` is checked, and there is
no other method to make sure `Flags.data_flow_trace` is not null, so
adding a null check for `Flags.data_flow_trace`.
Reviewed By: vitalybuka
Differential Revision: https://reviews.llvm.org/D145040
Added:
Modified:
compiler-rt/lib/fuzzer/FuzzerDriver.cpp
compiler-rt/test/fuzzer/dataflow.test
Removed:
################################################################################
diff --git a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
index 04b787f4d8ea1..8775de819d5a6 100644
--- a/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
+++ b/compiler-rt/lib/fuzzer/FuzzerDriver.cpp
@@ -797,7 +797,7 @@ int FuzzerDriver(int *argc, char ***argv, UserCallback Callback) {
if (Flags.verbosity)
Printf("INFO: Seed: %u\n", Seed);
- if (Flags.collect_data_flow && !Flags.fork &&
+ if (Flags.collect_data_flow && Flags.data_flow_trace && !Flags.fork &&
!(Flags.merge || Flags.set_cover_merge)) {
if (RunIndividualFiles)
return CollectDataFlow(Flags.collect_data_flow, Flags.data_flow_trace,
diff --git a/compiler-rt/test/fuzzer/dataflow.test b/compiler-rt/test/fuzzer/dataflow.test
index c7d703dbe82f2..9f35374916798 100644
--- a/compiler-rt/test/fuzzer/dataflow.test
+++ b/compiler-rt/test/fuzzer/dataflow.test
@@ -97,6 +97,11 @@ L20_FUZZM-NEXT: F1 00000000000000001000{{$}}
L20_FUZZM-NEXT: F2 00000000000000000001{{$}}
L20_FUZZM-NOT: F
+# Don't crash with missing data_flow args.
+RUN: rm -rf %t-DFT
+RUN: %t-ThreeFunctionsTest -collect_data_flow=%t-ThreeFunctionsTestDF
+RUN: %t-ThreeFunctionsTest -data_flow_trace=%t-DFT %t/IN/FUZZMU
+
# Test libFuzzer's built in DFT collection.
RUN: rm -rf %t-DFT
RUN: %t-ThreeFunctionsTest -collect_data_flow=%t-ThreeFunctionsTestDF -data_flow_trace=%t-DFT %t/IN/FUZZMU
More information about the llvm-commits
mailing list