-
-
Notifications
You must be signed in to change notification settings - Fork 405
test(fuzzing): include full parameter list in fuzzer log output #1760
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| Included the full parameter list in the fuzzer log output for test reproduction. I used AI to assist me with this change. @webdevsamran |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,15 +14,14 @@ | |
| # limitations under the License. | ||
| # | ||
| ################################################################################ | ||
| import base64 | ||
| import contextlib | ||
| import sys | ||
|
|
||
| import atheris | ||
|
|
||
| with atheris.instrument_imports(): | ||
| import icalendar.cal.calendar | ||
| from icalendar.tests.fuzzed import fuzz_v1_calendar | ||
| from icalendar.tests.fuzzed import format_fuzz_log, fuzz_v1_calendar | ||
|
|
||
|
|
||
| @atheris.instrument_func | ||
|
|
@@ -36,8 +35,11 @@ def TestOneInput(data): | |
| # print the ICS file for the test case extraction | ||
| # see https://stackoverflow.com/a/27367173/1320237 | ||
|
Comment on lines
35
to
36
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please keep this close to the |
||
| print( | ||
| base64.b64encode(calendar_string.encode("UTF-8", "surrogateescape")).decode( | ||
| "ASCII" | ||
| format_fuzz_log( | ||
| icalendar.cal.calendar.Calendar.from_ical, | ||
| multiple, | ||
| should_walk, | ||
| calendar_string, | ||
|
Comment on lines
37
to
+42
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On a second thought, this should be called from |
||
| ) | ||
| ) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -39,6 +39,26 @@ | |
| ] | ||
|
|
||
|
|
||
| def format_fuzz_log( | ||
| from_ical, multiple: bool, should_walk: bool, calendar_string: str | ||
| ) -> str: | ||
| """Format the log entry for fuzzed test case extraction. | ||
|
|
||
| Outputs entrypoint name, parameter values, and base64-encoded calendar content. | ||
| """ | ||
| import base64 | ||
|
|
||
| encoded = base64.b64encode( | ||
| calendar_string.encode("UTF-8", "surrogateescape") | ||
| if isinstance(calendar_string, str) | ||
| else calendar_string | ||
| ).decode("ASCII") | ||
| return ( | ||
| f"{from_ical.__qualname__} multiple={multiple} " | ||
| f"should_walk={should_walk} {encoded}" | ||
|
Comment on lines
+57
to
+58
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
f"{from_ical.__qualname__} multiple={multiple} "
f"should_walk={should_walk} {encoded}"
f"{version}{from_ical.__qualname__} multiple={multiple} "
f"should_walk={should_walk} {encoded}"
|
||
| ) | ||
|
|
||
|
|
||
| def fuzz_v1_calendar( | ||
| from_ical, calendar_string: str, multiple: bool, should_walk: bool | ||
| ): | ||
|
|
||