-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
envoy: modified identification of corpus path #1607
Changes from 3 commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
#!/usr/bin/python | ||
|
||
import os | ||
import sys | ||
import re | ||
|
||
fuzzer_target = sys.argv[1].split('/') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Use |
||
directory_segments, fuzz_test = fuzzer_target[:-1], fuzzer_target[-1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use pythonic functions :) os.path.dirname and os.path.basename There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. s/fuzz_test/fuzz_target_name or fuzzer_target_name |
||
directory = '/'.join(directory_segments) | ||
path = '../envoy/' + directory + '/BUILD' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please use os.path.join('..', 'envoy', ......) |
||
corpus_path = "" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. better to use None |
||
|
||
with open(path, 'r') as f: | ||
searchlines = f.readlines() | ||
for i, line in enumerate(searchlines): | ||
if fuzz_test in line: | ||
for l in searchlines[i:]: | ||
if 'corpus =' in l: | ||
corpus_path = l | ||
break | ||
if not corpus_path: | ||
raise Exception("No corpus path for the given fuzz target") | ||
print re.findall(r'"([^"]*)"', corpus_path)[0] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TARGET_CORPUS sounds better for name.