Skip to content
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

[Rust] Fix function/method discovery from harness #1824

Merged
merged 2 commits into from
Nov 19, 2024

Conversation

arthurscchan
Copy link
Contributor

This PR fixes the logic and adds more visit implementations to enable the Rust frontend to discover nested or chained function/method calls within the fuzz_target macro of the fuzzing harness.

@arthurscchan arthurscchan marked this pull request as ready for review November 19, 2024 19:15
@arthurscchan arthurscchan marked this pull request as draft November 19, 2024 19:19
@arthurscchan arthurscchan marked this pull request as ready for review November 19, 2024 19:22
Copy link
Contributor

@DavidKorczynski DavidKorczynski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please add sample improvements in the text. Such as from the httparse project

@arthurscchan
Copy link
Contributor Author

Originally, some nested and chained functions/methods were missing from the generated call tree. For example, when parsing this fuzzing harness in the httparse project, the call graph only contained the following result because chained function/method calls were ignored:

Call tree
fuzz_target /src/httparse/fuzz/fuzz_targets/parse_response_multspaces.rs linenumber=-1
  Response<'h,'b>::new /src/httparse/fuzz/fuzz_targets/parse_response_multspaces.rs linenumber=7

This PR updates the handling and discovery of function/method calls within nested or chained structures, ensuring all functions/methods are detected. The updated call tree now shows:

Call tree
fuzz_target /src/httparse/fuzz/fuzz_targets/parse_response_multspaces.rs linenumber=-1
  ParserConfig::allow_multiple_spaces_in_response_status_delimiters /src/httparse/fuzz/fuzz_targets/parse_response_multspaces.rs linenumber=9
  Response<'h,'b>::new /src/httparse/fuzz/fuzz_targets/parse_response_multspaces.rs linenumber=7
  ParserConfig::parse_response /src/httparse/fuzz/fuzz_targets/parse_response_multspaces.rs linenumber=10

@DavidKorczynski DavidKorczynski merged commit e34e691 into ossf:main Nov 19, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants