File tree Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Expand file tree Collapse file tree 2 files changed +73
-0
lines changed Original file line number Diff line number Diff line change
1
+ import sys
2
+
3
+ import atheris
4
+
5
+
6
+ with atheris .instrument_imports ():
7
+ from websockets .exceptions import SecurityError
8
+ from websockets .http11 import Request
9
+ from websockets .streams import StreamReader
10
+
11
+
12
+ def test_one_input (data ):
13
+ reader = StreamReader ()
14
+ reader .feed_data (data )
15
+ reader .feed_eof ()
16
+
17
+ try :
18
+ Request .parse (
19
+ reader .read_line ,
20
+ )
21
+ except (
22
+ EOFError , # connection is closed without a full HTTP request
23
+ SecurityError , # request exceeds a security limit
24
+ ValueError , # request isn't well formatted
25
+ ):
26
+ pass
27
+
28
+
29
+ def main ():
30
+ atheris .Setup (sys .argv , test_one_input )
31
+ atheris .Fuzz ()
32
+
33
+
34
+ if __name__ == "__main__" :
35
+ main ()
Original file line number Diff line number Diff line change
1
+ import sys
2
+
3
+ import atheris
4
+
5
+
6
+ with atheris .instrument_imports ():
7
+ from websockets .exceptions import SecurityError
8
+ from websockets .http11 import Response
9
+ from websockets .streams import StreamReader
10
+
11
+
12
+ def test_one_input (data ):
13
+ reader = StreamReader ()
14
+ reader .feed_data (data )
15
+ reader .feed_eof ()
16
+
17
+ try :
18
+ Response .parse (
19
+ reader .read_line ,
20
+ reader .read_exact ,
21
+ reader .read_to_eof ,
22
+ )
23
+ 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.
28
+ ):
29
+ pass
30
+
31
+
32
+ def main ():
33
+ atheris .Setup (sys .argv , test_one_input )
34
+ atheris .Fuzz ()
35
+
36
+
37
+ if __name__ == "__main__" :
38
+ main ()
You can’t perform that action at this time.
0 commit comments