diff options
author | Erik Dubbelboer <erik@dubbelboer.com> | 2024-02-21 06:02:19 +0100 |
---|---|---|
committer | Erik Dubbelboer <erik@dubbelboer.com> | 2024-02-21 06:02:19 +0100 |
commit | 4c326e8f6cee5c6737d10e23095e8d6e7383bc68 (patch) | |
tree | 85903380c6bc69c2cbaa62d9654c573717160d45 | |
parent | Upgrade golangci-lint to v1.56.2; fix gocritic issues (#1722) (diff) | |
download | fasthttp-4c326e8f6cee5c6737d10e23095e8d6e7383bc68.tar.gz fasthttp-4c326e8f6cee5c6737d10e23095e8d6e7383bc68.tar.bz2 fasthttp-4c326e8f6cee5c6737d10e23095e8d6e7383bc68.zip |
Limit memory for fuzz testing
CIFuzz has low memory limits that we keep hitting without there being an
issue.
-rw-r--r-- | fuzz_test.go | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/fuzz_test.go b/fuzz_test.go index e07f1a0..532c052 100644 --- a/fuzz_test.go +++ b/fuzz_test.go @@ -43,8 +43,9 @@ func FuzzResponseReadLimitBody(f *testing.F) { f.Add([]byte("HTTP/1.1 200 OK\r\nContent-Type: aa\r\nContent-Length: 10\r\n\r\n9876543210"), 1024) f.Fuzz(func(t *testing.T, body []byte, max int) { - // Don't do bodies bigger than 10kb. - max %= (10 * 1024) + if len(body) > 10*1024 || max > 10*1024 { + return + } var res Response @@ -58,8 +59,9 @@ func FuzzRequestReadLimitBody(f *testing.F) { f.Add([]byte("POST /a HTTP/1.1\r\nHost: a.com\r\nTransfer-Encoding: chunked\r\nContent-Type: aa\r\n\r\n6\r\nfoobar\r\n3\r\nbaz\r\n0\r\nfoobar\r\n\r\n"), 1024) f.Fuzz(func(t *testing.T, body []byte, max int) { - // Don't do bodies bigger than 10kb. - max %= (10 * 1024) + if len(body) > 10*1024 || max > 10*1024 { + return + } var req Request |