[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:42:40 PDT 2019
Dor1s created this revision.
Dor1s added a reviewer: kcc.
Herald added subscribers: Sanitizers, delcypher.
Herald added projects: LLVM, Sanitizers.
Otherwise, the scripts might be wasting too much time trying to
collect and process traces from the long inputs. For more context, see
https://github.com/google/oss-fuzz/issues/1632#issuecomment-481761789
I suspect that the problem might be in the `if ret and r[1] - r[0] >= 2`
condition. When the second part is false, we might want to break out of the
loop and skip the input at all, but am not 100% sure.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D60538
Files:
lib/fuzzer/scripts/collect_data_flow.py
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.194582.patch
Type: text/x-patch
Size: 1105 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190410/db0d9756/attachment.bin>
More information about the llvm-commits
mailing list