Skip to content

Commit

Permalink
introspector: force header-only targets (#414)
Browse files Browse the repository at this point in the history
Adds a new option from fuzz introspector that makes it possible to
select benchmarks only if they are determined to be declared in a header
file. This is part of a wider effort in more accurately descriping the
header files to include in a given harness.

Ref: ossf/fuzz-introspector#1624
Ref: ossf/fuzz-introspector#1641

Signed-off-by: David Korczynski <david@adalogics.com>
  • Loading branch information
DavidKorczynski authored Jul 3, 2024
1 parent 9c124d9 commit 9f9c44f
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions data_prep/introspector.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
int(os.getenv('OSS_FUZZ_AVOID_STATIC_FUNCTIONS', '1')))
ORACLE_ONLY_REFERENCED_FUNCTIONS = bool(
int(os.getenv('OSS_FUZZ_ONLY_REFERENCED_FUNCTIONS', '0')))
ORACLE_ONLY_FUNCTIONS_WITH_HEADER_DECLARATIONS = bool(
int(os.getenv('OSS_FUZZ_ONLY_FUNCS_WITH_HEADER_DECLARATION', '1')))

DEFAULT_INTROSPECTOR_ENDPOINT = 'https://introspector.oss-fuzz.com/api'
INTROSPECTOR_ENDPOINT = ''
Expand Down Expand Up @@ -192,9 +194,14 @@ def query_introspector_oracle(project: str, oracle_api: str) -> list[dict]:
"""Queries a fuzz target oracle API from Fuzz Introspector."""
resp = _query_introspector(
oracle_api, {
'project': project,
'exclude-static-functions': ORACLE_AVOID_STATIC_FUNCTIONS,
'only-referenced-functions': ORACLE_ONLY_REFERENCED_FUNCTIONS,
'project':
project,
'exclude-static-functions':
ORACLE_AVOID_STATIC_FUNCTIONS,
'only-referenced-functions':
ORACLE_ONLY_REFERENCED_FUNCTIONS,
'only-with-header-file-declaration':
ORACLE_ONLY_FUNCTIONS_WITH_HEADER_DECLARATIONS,
})
return _get_data(resp, 'functions', [])

Expand Down

0 comments on commit 9f9c44f

Please sign in to comment.