tests/fuzz_url.py
raw| 1 | import sys |
| 2 | import atheris |
| 3 | |
| 4 | with atheris.instrument_imports(): |
| 5 | import httplib2 |
| 6 | |
| 7 | |
| 8 | @atheris.instrument_func |
| 9 | def TestOneInput(data): |
| 10 | fdp = atheris.FuzzedDataProvider(data) |
| 11 | original = fdp.ConsumeUnicode(sys.maxsize) |
| 12 | try: |
| 13 | httplib2.urlnorm(original) |
| 14 | except httplib2.RelativeURIError: |
| 15 | return |
| 16 | return |
| 17 | |
| 18 | |
| 19 | def main(): |
| 20 | atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True) |
| 21 | atheris.Fuzz() |
| 22 | |
| 23 | |
| 24 | if __name__ == "__main__": |
| 25 | main() |