summaryrefslogtreecommitdiffstats
path: root/compiler-rt/lib/fuzzer/scripts/collect_data_flow.py
diff options
context:
space:
mode:
authorMax Moroz <mmoroz@chromium.org>2019-04-12 21:00:12 +0000
committerMax Moroz <mmoroz@chromium.org>2019-04-12 21:00:12 +0000
commitb6e6d3c740a4b94a64ad62745a18571f1a9cb3cb (patch)
treeb157a324eb0d9219f0c09b16245c0297c48321c0 /compiler-rt/lib/fuzzer/scripts/collect_data_flow.py
parent9e27514996e7dd183cd84b59656ac64b7514776f (diff)
downloadbcm5719-llvm-b6e6d3c740a4b94a64ad62745a18571f1a9cb3cb.tar.gz
bcm5719-llvm-b6e6d3c740a4b94a64ad62745a18571f1a9cb3cb.zip
[libFuzzer] Fix DataFlow.cpp logic when tracing long inputs.
Summary: 1. Do not create DFSan labels for the bytes which we do not trace. This is where we run out of labels at the first place. 2. When dumping the traces on the disk, make sure to offset the label identifiers by the number of the first byte in the trace range. 3. For the last label, make sure to write it at the last position of the trace bit string, as that label represents the input size, not any particular byte. Also fixed the bug with division in python which I've introduced when migrated the scripts to Python3 (`//` is required for integral division). Otherwise, the scripts are wasting too much time unsuccessfully trying to collect and process traces from the long inputs. For more context, see https://github.com/google/oss-fuzz/issues/1632#issuecomment-481761789 Reviewers: kcc Reviewed By: kcc Subscribers: delcypher, #sanitizers, llvm-commits Tags: #llvm, #sanitizers Differential Revision: https://reviews.llvm.org/D60538 llvm-svn: 358311
Diffstat (limited to 'compiler-rt/lib/fuzzer/scripts/collect_data_flow.py')
-rwxr-xr-xcompiler-rt/lib/fuzzer/scripts/collect_data_flow.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler-rt/lib/fuzzer/scripts/collect_data_flow.py b/compiler-rt/lib/fuzzer/scripts/collect_data_flow.py
index e8b56a71910..bd601eb63ab 100755
--- a/compiler-rt/lib/fuzzer/scripts/collect_data_flow.py
+++ b/compiler-rt/lib/fuzzer/scripts/collect_data_flow.py
@@ -65,8 +65,8 @@ def main(argv):
tmpfile = os.path.join(tmpdir, str(r[0]) + "-" + str(r[1]))
ret = subprocess.call([exe, str(r[0]), str(r[1]), inp, tmpfile])
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]])
+ 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)
OpenPOWER on IntegriCloud