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") 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