[PATCH] D60538: [libFuzzer] Skip too long inputs in the data flow scripts.
Max Moroz via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 10 13:45:45 PDT 2019
Dor1s updated this revision to Diff 194583.
Dor1s added a comment.
Update the test to reflect the change and make sure it passes.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D60538/new/
https://reviews.llvm.org/D60538
Files:
lib/fuzzer/scripts/collect_data_flow.py
test/fuzzer/dataflow.test
Index: test/fuzzer/dataflow.test
===================================================================
--- test/fuzzer/dataflow.test
+++ test/fuzzer/dataflow.test
@@ -70,8 +70,8 @@
RUN: %t-ExplodeDFSanLabelsTestDF 0 2 %t/IN/1234567890123456
RUN: %t-ExplodeDFSanLabelsTestDF 2 4 %t/IN/1234567890123456
RUN: %t-ExplodeDFSanLabelsTestDF 4 6 %t/IN/1234567890123456
-# Or we can use collect_data_flow
-RUN: %libfuzzer_src/scripts/collect_data_flow.py %t-ExplodeDFSanLabelsTestDF %t/IN/1234567890123456
+# Or we can use collect_data_flow and fail as well
+RUN: not %libfuzzer_src/scripts/collect_data_flow.py %t-ExplodeDFSanLabelsTestDF %t/IN/1234567890123456
# Test that we can run collect_data_flow on the entire corpus dir
RUN: rm -rf %t/OUT
Index: lib/fuzzer/scripts/collect_data_flow.py
===================================================================
--- lib/fuzzer/scripts/collect_data_flow.py
+++ lib/fuzzer/scripts/collect_data_flow.py
@@ -63,13 +63,26 @@
r = q.pop()
print("******* Trying: ", r)
tmpfile = os.path.join(tmpdir, str(r[0]) + "-" + str(r[1]))
- ret = subprocess.call([exe, str(r[0]), str(r[1]), inp, tmpfile])
+
+ proc = subprocess.Popen([exe, str(r[0]), str(r[1]), inp, tmpfile],
+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ output, err = proc.communicate()
+ if b'FATAL: DataFlowSanitizer: out of labels' in err:
+ print('The input is too long, skipping.')
+ break
+
+ ret = proc.returncode
if ret and r[1] - r[0] >= 2:
q.append([r[0], (r[1] + r[0]) / 2])
q.append([(r[1] + r[0]) / 2, r[1]])
else:
outputs.append(tmpfile)
print("******* Success: ", r)
+
+ if len(outputs) == 0:
+ print('No traces to merge. Exiting.')
+ sys.exit(1)
+
f = sys.stdout
if len(argv) >= 4:
f = open(argv[3], "w")
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D60538.194583.patch
Type: text/x-patch
Size: 1852 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190410/f85a2e95/attachment.bin>
More information about the llvm-commits
mailing list