aboutsummaryrefslogtreecommitdiff
path: root/infra/cifuzz/fuzz_target.py
diff options
context:
space:
mode:
authorLeo Neat <lneat@google.com>2020-04-28 12:31:36 -0700
committerGitHub <noreply@github.com>2020-04-28 12:31:36 -0700
commit9b30127675b0bf295648e2f907df0d756ff5a2eb (patch)
tree0320224a9e998988d2eea563aa4fcda1d1291964 /infra/cifuzz/fuzz_target.py
parentf52c9385c04a0a22057b7f6f104573d6e97ca2af (diff)
downloadoss-fuzz-9b30127675b0bf295648e2f907df0d756ff5a2eb.tar.gz
[CIFuzz] Add support for different sanitizers (#3516)
Diffstat (limited to 'infra/cifuzz/fuzz_target.py')
-rw-r--r--infra/cifuzz/fuzz_target.py18
1 files changed, 11 insertions, 7 deletions
diff --git a/infra/cifuzz/fuzz_target.py b/infra/cifuzz/fuzz_target.py
index 85fdbdc93..60b151459 100644
--- a/infra/cifuzz/fuzz_target.py
+++ b/infra/cifuzz/fuzz_target.py
@@ -51,9 +51,6 @@ BUILD_ARCHIVE_NAME = 'oss_fuzz_latest.zip'
# Zip file name containing the corpus.
CORPUS_ZIP_NAME = 'public.zip'
-# The sanitizer build to download.
-SANITIZER = 'address'
-
# The number of reproduce attempts for a crash.
REPRODUCE_ATTEMPTS = 10
@@ -72,7 +69,13 @@ class FuzzTarget:
project_name: The name of the relevant OSS-Fuzz project.
"""
- def __init__(self, target_path, duration, out_dir, project_name=None):
+ #pylint: disable=too-many-arguments
+ def __init__(self,
+ target_path,
+ duration,
+ out_dir,
+ project_name=None,
+ sanitizer='address'):
"""Represents a single fuzz target.
Note: project_name should be none when the fuzzer being run is not
@@ -89,6 +92,7 @@ class FuzzTarget:
self.target_path = target_path
self.out_dir = out_dir
self.project_name = project_name
+ self.sanitizer = sanitizer
def fuzz(self):
"""Starts the fuzz target run for the length of time specified by duration.
@@ -108,8 +112,8 @@ class FuzzTarget:
command += ['-v', '%s:%s' % (self.out_dir, '/out')]
command += [
- '-e', 'FUZZING_ENGINE=libfuzzer', '-e', 'SANITIZER=address', '-e',
- 'RUN_FUZZER_MODE=interactive', 'gcr.io/oss-fuzz-base/base-runner',
+ '-e', 'FUZZING_ENGINE=libfuzzer', '-e', 'SANITIZER=' + self.sanitizer,
+ '-e', 'RUN_FUZZER_MODE=interactive', 'gcr.io/oss-fuzz-base/base-runner',
'bash', '-c'
]
@@ -253,7 +257,7 @@ class FuzzTarget:
return None
version = VERSION_STRING.format(project_name=self.project_name,
- sanitizer=SANITIZER)
+ sanitizer=self.sanitizer)
version_url = url_join(GCS_BASE_URL, CLUSTERFUZZ_BUILDS, self.project_name,
version)
try: