-
Notifications
You must be signed in to change notification settings - Fork 177
Get and log the source code of the fuzz target and build script. #1065
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
base: main
Are you sure you want to change the base?
Conversation
This commit also modifies the create_ossfuzz_project to return the path of the generated oss-fuzz project so it can read the files from the project. Finally, this commit adds the retrieved sources to the report log.
fuzz_target_path, build_script_path) | ||
|
||
status_path = os.path.join(last_result.work_dirs.status, | ||
f'{last_result.trial:02}') | ||
os.makedirs(status_path, exist_ok=True) | ||
|
||
# Get the source code of the fuzz target and build script from the generated oss-fuzz projects. | ||
fuzz_target_source_path = os.path.join(generated_project_path, f'{last_result.trial:02d}.fuzz_target') |
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.
I could have just reused the existing fuzz_target_path. However, I wanted to actually log the version of the fuzz_target in the generated_oss_fuzz project (in case it differed with the version produced in the last_result.work_dirs.fuzz_targets path and stored in the current fuzz_target_path variables).
I could revert and use fuzz_target_path directly if necessary.
@@ -280,7 +280,8 @@ def create_ossfuzz_project(self, | |||
f'{self.benchmark.target_path}\n') | |||
|
|||
if not build_script_path or os.path.getsize(build_script_path) == 0: | |||
return name |
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.
I checked callers of this function to see if this returned name
variable is being used. I didn't find any usage, hence believed it was safe to change it.
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.
hey @AmPaschal , thanks for this change! Can you please add some context / reasoning behind this change in the PR description?
I have updated the PR description. |
This Pull Request modifies oss-fuzz-gen to retrieve and log the fuzz target and build script, used in each fuzzing cycle, in the experiment's final report.
This is to facilitate debugging and improve fuzzing transparency during fuzz target generation.