Improving urllib3 utils coverage (#9631)

This is an improvement to the urllib3 utils functions fuzzing. This is
my first attempt at contributing to oss-fuzz so feedback appreciated on
whether this custom mutator approach is ok.

- `parse_url` function
We now have a custom mutator that drives more url like structures. I
originally developed this using Hypothesis, but the quality of fuzzing
wasn't good (seems to be a known issue
https://github.com/google/atheris/issues/20). Because of this I've used
a 3rd party library `exrex` that can generate test data from regular
expressions.
This commit is contained in:
SGills 2023-02-21 14:27:05 +00:00 committed by GitHub
parent 5524977fff
commit a93638ce02
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -23,7 +23,12 @@ def TestOneInput(data):
original = fdp.ConsumeUnicode(sys.maxsize)
try:
urllib3.util.parse_url(original)
response = urllib3.util.parse_url(original)
response.hostname
response.request_uri
response.authority
response.netloc
response.url
except urllib3.exceptions.LocationParseError:
None
return