File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,11 @@ func FuzzResponseReadLimitBody(f *testing.F) {
43
43
f .Add ([]byte ("HTTP/1.1 200 OK\r \n Content-Type: aa\r \n Content-Length: 10\r \n \r \n 9876543210" ), 1024 )
44
44
45
45
f .Fuzz (func (t * testing.T , body []byte , max int ) {
46
- if len (body ) > 10 * 1024 || max > 10 * 1024 {
46
+ if len (body ) > 1024 * 1024 || max > 1024 * 1024 {
47
+ return
48
+ }
49
+ // Only test with a max for the body, otherwise a very large Content-Length will just OOM.
50
+ if max <= 0 {
47
51
return
48
52
}
49
53
@@ -58,7 +62,11 @@ func FuzzRequestReadLimitBody(f *testing.F) {
58
62
f .Add ([]byte ("POST /a HTTP/1.1\r \n Host: a.com\r \n Transfer-Encoding: chunked\r \n Content-Type: aa\r \n \r \n 6\r \n foobar\r \n 3\r \n baz\r \n 0\r \n foobar\r \n \r \n " ), 1024 )
59
63
60
64
f .Fuzz (func (t * testing.T , body []byte , max int ) {
61
- if len (body ) > 10 * 1024 || max > 10 * 1024 {
65
+ if len (body ) > 1024 * 1024 || max > 1024 * 1024 {
66
+ return
67
+ }
68
+ // Only test with a max for the body, otherwise a very large Content-Length will just OOM.
69
+ if max <= 0 {
62
70
return
63
71
}
64
72
You can’t perform that action at this time.
0 commit comments