Skip to content

Commit a26cec2

Browse files
committed
Make fuzz targets actually run.
1 parent fd17f46 commit a26cec2

File tree

2 files changed

+19
-12
lines changed

2 files changed

+19
-12
lines changed

fuzzing/fuzz_http11_request_parser.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,14 @@ def test_one_input(data):
1414
reader.feed_data(data)
1515
reader.feed_eof()
1616

17+
parser = Request.parse(
18+
reader.read_line,
19+
)
20+
1721
try:
18-
Request.parse(
19-
reader.read_line,
20-
)
22+
next(parser)
23+
except StopIteration:
24+
pass # request is available in exc.value
2125
except (
2226
EOFError, # connection is closed without a full HTTP request
2327
SecurityError, # request exceeds a security limit

fuzzing/fuzz_http11_response_parser.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,20 @@ def test_one_input(data):
1414
reader.feed_data(data)
1515
reader.feed_eof()
1616

17+
parser = Response.parse(
18+
reader.read_line,
19+
reader.read_exact,
20+
reader.read_to_eof,
21+
)
1722
try:
18-
Response.parse(
19-
reader.read_line,
20-
reader.read_exact,
21-
reader.read_to_eof,
22-
)
23+
next(parser)
24+
except StopIteration:
25+
pass # response is available in exc.value
2326
except (
24-
EOFError, # connection is closed without a full HTTP response.
25-
SecurityError, # response exceeds a security limit.
26-
LookupError, # response isn't well formatted.
27-
ValueError, # response isn't well formatted.
27+
EOFError, # connection is closed without a full HTTP response
28+
SecurityError, # response exceeds a security limit
29+
LookupError, # response isn't well formatted
30+
ValueError, # response isn't well formatted
2831
):
2932
pass
3033

0 commit comments

Comments
 (0)