mirror of https://github.com/google/oss-fuzz.git
Prevent misuse of check_build (#2340)
Don't allow using check_build with builds it doesn't actually support.
This commit is contained in:
parent
30190987f4
commit
c3d7aba005
|
@ -95,8 +95,9 @@ def main():
|
|||
|
||||
check_build_parser = subparsers.add_parser(
|
||||
'check_build', help='Checks that fuzzers execute without errors.')
|
||||
_add_engine_args(check_build_parser)
|
||||
_add_sanitizer_args(check_build_parser)
|
||||
_add_engine_args(check_build_parser, choices=['libfuzzer', 'afl'])
|
||||
_add_sanitizer_args(check_build_parser,
|
||||
choices=['address', 'memory', 'undefined'])
|
||||
_add_environment_args(check_build_parser)
|
||||
check_build_parser.add_argument('project_name', help='name of the project')
|
||||
check_build_parser.add_argument('fuzzer_name', help='name of the fuzzer',
|
||||
|
@ -248,17 +249,18 @@ def _get_work_dir(project_name=''):
|
|||
return os.path.join(BUILD_DIR, 'work', project_name)
|
||||
|
||||
|
||||
def _add_engine_args(parser):
|
||||
def _add_engine_args(parser, choices=None):
|
||||
"""Add common engine args."""
|
||||
parser.add_argument('--engine', default='libfuzzer',
|
||||
choices=['libfuzzer', 'afl', 'honggfuzz', 'dataflow', 'none'])
|
||||
if choices is None:
|
||||
choices = ['libfuzzer', 'afl', 'honggfuzz', 'dataflow', 'none']
|
||||
parser.add_argument('--engine', default='libfuzzer', choices=choices)
|
||||
|
||||
|
||||
def _add_sanitizer_args(parser):
|
||||
def _add_sanitizer_args(parser, choices=None):
|
||||
"""Add common sanitizer args."""
|
||||
parser.add_argument(
|
||||
'--sanitizer', default='address',
|
||||
choices=['address', 'memory', 'undefined', 'coverage', 'dataflow'])
|
||||
if choices is None:
|
||||
choices = ['address', 'memory', 'undefined', 'coverage', 'dataflow']
|
||||
parser.add_argument('--sanitizer', default='address', choices=choices)
|
||||
|
||||
|
||||
def _add_environment_args(parser):
|
||||
|
|
Loading…
Reference in New Issue