aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Erik Dubbelboer <erik@dubbelboer.com> 2024-01-30 08:01:06 +0100
committerGravatar Erik Dubbelboer <erik@dubbelboer.com> 2024-01-30 08:01:06 +0100
commit48dd2d0ce7120eee4fd535042b97a2fea7a66f4e (patch)
tree7e8da2c42ec7746fdc890fce7698c8676dd021c2
parentMake Fuzz tests deterministic (diff)
downloadfasthttp-48dd2d0ce7120eee4fd535042b97a2fea7a66f4e.tar.gz
fasthttp-48dd2d0ce7120eee4fd535042b97a2fea7a66f4e.tar.bz2
fasthttp-48dd2d0ce7120eee4fd535042b97a2fea7a66f4e.zip
Try fixing oss-fuzz running out of memory and skipping a lot
-rw-r--r--fuzz_test.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/fuzz_test.go b/fuzz_test.go
index f797ee4..01ea4f7 100644
--- a/fuzz_test.go
+++ b/fuzz_test.go
@@ -43,9 +43,8 @@ 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) {
- if max > 1024*1024 { // Skip limits higher than 1MB.
- return
- }
+ // Don't do bodies bigger than 10kb.
+ max = max % (10 * 1024)
var res Response
@@ -59,9 +58,8 @@ 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) {
- if max > 1024*1024 { // Skip limits higher than 1MB.
- return
- }
+ // Don't do bodies bigger than 10kb.
+ max = max % (10 * 1024)
var req Request