Visitar URL original
initial fuzz testing integration with OSS-Fuzz · httplib2/httplib2@33090ab · GitHub
Skip to content

Commit 33090ab

Browse files
initial fuzz testing integration with OSS-Fuzz
#184 google/oss-fuzz#5000
1 parent 595e248 commit 33090ab

2 files changed

Lines changed: 42 additions & 0 deletions

File tree

‎tests/fuzz_request.py‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import sys
2+
import httplib2
3+
import atheris
4+
import tests
5+
6+
7+
def TestOneInput(input_bytes):
8+
http = httplib2.Http()
9+
ib = b"HTTP/1.0 200 OK\r\n" + input_bytes
10+
with tests.server_const_bytes(ib) as uri:
11+
http.request(uri)
12+
13+
14+
def main():
15+
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
16+
atheris.Fuzz()
17+
18+
19+
if __name__ == "__main__":
20+
main()

‎tests/fuzz_url.py‎

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import sys
2+
import atheris
3+
import httplib2
4+
5+
6+
def TestOneInput(data):
7+
fdp = atheris.FuzzedDataProvider(data)
8+
original = fdp.ConsumeUnicode(sys.maxsize)
9+
try:
10+
httplib2.urlnorm(original)
11+
except httplib2.RelativeURIError:
12+
return
13+
return
14+
15+
16+
def main():
17+
atheris.Setup(sys.argv, TestOneInput, enable_python_coverage=True)
18+
atheris.Fuzz()
19+
20+
21+
if __name__ == "__main__":
22+
main()

0 commit comments

Comments
 (0)