diff --git a/fuzz_test.go b/fuzz_test.go index d3f7967..def7b8f 100644 --- a/fuzz_test.go +++ b/fuzz_test.go @@ -117,6 +117,13 @@ func FuzzURIParse(f *testing.F) { f.Add(`http://google.com#@github.com`) f.Fuzz(func(t *testing.T, uri string) { + // Limit the size of the URI to avoid OOMs or timeouts. + // When using Server or Client the maximum URI is dicated by the maximum header size, + // which defaults to defaultReadBufferSize (4096 bytes). + if len(uri) > defaultReadBufferSize { + return + } + var u URI uri = strings.ToLower(uri)