| 1 | package utilsscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ |
| 2 | |
| 3 | import ( |
| 4 | "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/" |
| 5 | "encoding/jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/" |
| 6 | "errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/" |
| 7 | "net/httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/" |
| 8 | "net/netipscip-go gomod github.com/golang/go/src go1.25.0 `net/netip`/" |
| 9 | "net/urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/" |
| 10 | "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/" |
| 11 | "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/" |
| 12 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 13 | ) |
| 14 | |
| 15 | // Fuzz targets comparing the SWAR implementations against the scalar |
| 16 | // references from the unit tests. The seeds cover the known traps (HTAB, |
| 17 | // CR|0x20, overlap tails, 19-20 digit boundaries); go test runs the seeds |
| 18 | // as regular tests, go test -fuzz explores beyond them. |
| 19 | |
| 20 | func FuzzIndexFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzIndexFold().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 21 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("max-age=0,No-Cache,private", "no-cache") |
| 22 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("no\rcache", "no-cache") |
| 23 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("aaaaaaaaaaaaNO-CACHE", "no-cache") |
| 24 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("aaaaaaagz", "gzip") |
| 25 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("__Proxy-Authorization: basic", "proxy-authorization") |
| 26 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("\xe9abc", "\xc9abc") |
| 27 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("", "") |
| 28 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s, needle string) { |
| 29 | want := refIndexFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/refIndexFold().(s, needle) |
| 30 | if got := IndexFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IndexFold().(s, needle); got != want { |
| 31 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("IndexFold(%q, %q) = %d, want %d", s, needle, got, want) |
| 32 | } |
| 33 | if got := IndexFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IndexFold().([]byte(s), needle); got != want { |
| 34 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("IndexFold(bytes %q, %q) = %d, want %d", s, needle, got, want) |
| 35 | } |
| 36 | if got := ContainsFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ContainsFold().(s, needle); got != (want >= 0) { |
| 37 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ContainsFold(%q, %q) = %v, want %v", s, needle, got, want >= 0) |
| 38 | } |
| 39 | }) |
| 40 | } |
| 41 | |
| 42 | func FuzzEqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzEqualFold().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 43 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Content-Type", "content-type") |
| 44 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("no\rcache", "no-cache") |
| 45 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("\xc9abc", "\xe9abc") |
| 46 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("aaaaaaaaaaaaX", "aaaaaaaaaaaax") |
| 47 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, a, b string) { |
| 48 | want := bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.Equalscip-go gomod github.com/golang/go/src go1.25.0 bytes/Equal().(asciiFoldUpperBscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/asciiFoldUpperB().([]byte(a)), asciiFoldUpperBscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/asciiFoldUpperB().([]byte(b))) |
| 49 | if got := EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/EqualFold().(a, b); got != want { |
| 50 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("EqualFold(%q, %q) = %v, want %v", a, b, got, want) |
| 51 | } |
| 52 | if got := EqualFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/EqualFold().([]byte(a), []byte(b)); got != want { |
| 53 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("EqualFold(bytes %q, %q) = %v, want %v", a, b, got, want) |
| 54 | } |
| 55 | }) |
| 56 | } |
| 57 | |
| 58 | func FuzzPrefixSuffixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzPrefixSuffixFold().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 59 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Bearer abc.def", "bearer ") |
| 60 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("no\rcache", "no-cache") |
| 61 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("MULTIPART/FORM-DATA; boundary=X", "multipart/form-data") |
| 62 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("application/ATOM+XML", "atom+xml") |
| 63 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("\xe9abcdefgh", "\xc9abcdefgh") |
| 64 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("", "") |
| 65 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s, needle string) { |
| 66 | if want := refHasPrefixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/refHasPrefixFold().(s, needle); HasPrefixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/HasPrefixFold().(s, needle) != want { |
| 67 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("HasPrefixFold(%q, %q) != %v", s, needle, want) |
| 68 | } else if HasPrefixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/HasPrefixFold().([]byte(s), needle) != want { |
| 69 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("HasPrefixFold(bytes %q, %q) != %v", s, needle, want) |
| 70 | } |
| 71 | if want := refHasSuffixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/refHasSuffixFold().(s, needle); HasSuffixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/HasSuffixFold().(s, needle) != want { |
| 72 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("HasSuffixFold(%q, %q) != %v", s, needle, want) |
| 73 | } else if HasSuffixFoldscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/HasSuffixFold().([]byte(s), needle) != want { |
| 74 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("HasSuffixFold(bytes %q, %q) != %v", s, needle, want) |
| 75 | } |
| 76 | }) |
| 77 | } |
| 78 | |
| 79 | func FuzzParsescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzParse().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 80 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("9223372036854775807") |
| 81 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("9223372036854775808") |
| 82 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("18446744073709551616") |
| 83 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("00000000000000000001") |
| 84 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("-9223372036854775808") |
| 85 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("12345678\n2345678") |
| 86 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("+0") |
| 87 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 88 | gotU, errU := ParseUintscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseUint().(s) |
| 89 | wantU, wantErrU := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseUintscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseUint().(s, 10, 64) |
| 90 | if (errU == nil) != (wantErrU == nil) { |
| 91 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseUint(%q) err = %v, strconv err = %v", s, errU, wantErrU) |
| 92 | } |
| 93 | switch { |
| 94 | case wantErrU == nil && gotU != wantU: |
| 95 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseUint(%q) = %d, want %d", s, gotU, wantU) |
| 96 | case wantErrU != nil && gotU != 0: |
| 97 | // Unlike strconv, this library returns 0 (not a clamped value) |
| 98 | // alongside every error. |
| 99 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseUint(%q) returned %d with error", s, gotU) |
| 100 | } |
| 101 | |
| 102 | gotI, errI := ParseIntscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseInt().(s) |
| 103 | wantI, wantErrI := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.ParseIntscip-go gomod github.com/golang/go/src go1.25.0 strconv/ParseInt().(s, 10, 64) |
| 104 | if (errI == nil) != (wantErrI == nil) { |
| 105 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseInt(%q) err = %v, strconv err = %v", s, errI, wantErrI) |
| 106 | } |
| 107 | switch { |
| 108 | case wantErrI == nil && gotI != wantI: |
| 109 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseInt(%q) = %d, want %d", s, gotI, wantI) |
| 110 | case wantErrI != nil && gotI != 0: |
| 111 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseInt(%q) returned %d with error", s, gotI) |
| 112 | } |
| 113 | }) |
| 114 | } |
| 115 | |
| 116 | func FuzzURLEscapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzURLEscape().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 117 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("") |
| 118 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("a b&c=d/e?f") |
| 119 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("caf%C3%A9+r%C3%A9sum%C3%A9") |
| 120 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("trailing%") |
| 121 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("trailing%2") |
| 122 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("%zz%1g%%41") |
| 123 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("100%+tax") |
| 124 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("\x00\x1f\x7f\xff") |
| 125 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 126 | if want := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.QueryEscapescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/QueryEscape().(s); want != string(AppendQueryEscapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendQueryEscape().(nil, s)) || |
| 127 | want != string(AppendQueryEscapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendQueryEscape().(nil, []byte(s))) { |
| 128 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("AppendQueryEscape(%q) diverges from net/url (%q)", s, want) |
| 129 | } |
| 130 | if want := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.PathEscapescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/PathEscape().(s); want != string(AppendPathEscapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendPathEscape().(nil, s)) || |
| 131 | want != string(AppendPathEscapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendPathEscape().(nil, []byte(s))) { |
| 132 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("AppendPathEscape(%q) diverges from net/url (%q)", s, want) |
| 133 | } |
| 134 | |
| 135 | checkUnescape := func(name, s string, got []byte, err error, want string, wantErr error) { |
| 136 | t.Helperscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Helper().() |
| 137 | if wantErr != nil { |
| 138 | if !errorsscip-go gomod github.com/golang/go/src go1.25.0 errors/.Isscip-go gomod github.com/golang/go/src go1.25.0 errors/Is().(err, wantErr) { |
| 139 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%s(%q) err = %v, want %v", name, s, err, wantErr) |
| 140 | } |
| 141 | if len(got) != 0 { |
| 142 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%s(%q) produced output alongside error", name, s) |
| 143 | } |
| 144 | return |
| 145 | } |
| 146 | if err != nil { |
| 147 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%s(%q) err = %v, want nil", name, s, err) |
| 148 | } |
| 149 | if string(got) != want { |
| 150 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("%s(%q) = %q, want %q", name, s, got, want) |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | wantQ, wantQErr := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.QueryUnescapescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/QueryUnescape().(s) |
| 155 | gotQ, errQ := AppendQueryUnescapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendQueryUnescape().(nil, s) |
| 156 | checkUnescape("AppendQueryUnescape", s, gotQ, errQ, wantQ, wantQErr) |
| 157 | gotQB, errQB := AppendQueryUnescapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendQueryUnescape().(nil, []byte(s)) |
| 158 | checkUnescape("AppendQueryUnescape(bytes)", s, gotQB, errQB, wantQ, wantQErr) |
| 159 | |
| 160 | wantP, wantPErr := urlscip-go gomod github.com/golang/go/src go1.25.0 `net/url`/.PathUnescapescip-go gomod github.com/golang/go/src go1.25.0 `net/url`/PathUnescape().(s) |
| 161 | gotP, errP := AppendPathUnescapescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendPathUnescape().(nil, s) |
| 162 | checkUnescape("AppendPathUnescape", s, gotP, errP, wantP, wantPErr) |
| 163 | }) |
| 164 | } |
| 165 | |
| 166 | func FuzzHTTPDatescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzHTTPDate().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 167 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Sun, 06 Nov 1994 08:49:37 GMT") |
| 168 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Sunday, 06-Nov-94 08:49:37 GMT") |
| 169 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Sun Nov 6 08:49:37 1994") |
| 170 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().(" Tue, 29 Feb 2000 12:00:00 GMT\r\n") |
| 171 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Tue, 29 Feb 1900 12:00:00 GMT") |
| 172 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("sun, 06 nov 1994 08:49:37 GMT") |
| 173 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Sun, 06 Nov 1994 08:49:37 UTC") |
| 174 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Mon, 01 Jan 0001 00:00:00 GMT") |
| 175 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("not a date") |
| 176 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 177 | want, wantErr := refParseHTTPDatescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/refParseHTTPDate().(s) |
| 178 | got, err := ParseHTTPDatescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseHTTPDate().(s) |
| 179 | if (err == nil) != (wantErr == nil) { |
| 180 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseHTTPDate(%q) err = %v, reference err = %v", s, err, wantErr) |
| 181 | } |
| 182 | if wantErr == nil { |
| 183 | if !got.Equalscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Equal().(want) { |
| 184 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseHTTPDate(%q) = %v, want %v", s, got, want) |
| 185 | } |
| 186 | if got.Locationscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Location().().Stringscip-go gomod github.com/golang/go/src go1.25.0 time/Location#String().() != want.Locationscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Location().().Stringscip-go gomod github.com/golang/go/src go1.25.0 time/Location#String().() { |
| 187 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseHTTPDate(%q) location = %v, want %v", s, got.Locationscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Location().(), want.Locationscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Location().()) |
| 188 | } |
| 189 | // Canonical output re-parses through the fast path to the same |
| 190 | // instant, and formatting agrees with the stdlib layout. |
| 191 | if want.Yearscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Year().() >= 0 && want.Yearscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Year().() <= 9999 { |
| 192 | formatted := FormatHTTPDatescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FormatHTTPDate().(want) |
| 193 | if formatted != want.UTCscip-go gomod github.com/golang/go/src go1.25.0 time/Time#UTC().().Formatscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Format().(httpDateLayoutscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/httpDateLayout.) { |
| 194 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("FormatHTTPDate(%v) = %q diverges from stdlib", want, formatted) |
| 195 | } |
| 196 | round, roundErr := ParseHTTPDatescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseHTTPDate().(formatted) |
| 197 | if roundErr != nil || !round.Equalscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Equal().(want) { |
| 198 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("round trip of %q failed: %v, %v", formatted, round, roundErr) |
| 199 | } |
| 200 | } |
| 201 | } |
| 202 | if gotBytes, errBytes := ParseHTTPDatescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseHTTPDate().([]byte(s)); (errBytes == nil) != (err == nil) || (err == nil && !gotBytes.Equalscip-go gomod github.com/golang/go/src go1.25.0 time/Time#Equal().(got)) { |
| 203 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseHTTPDate(bytes %q) diverges from string form", s) |
| 204 | } |
| 205 | }) |
| 206 | } |
| 207 | |
| 208 | func FuzzAppendJSONStringscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzAppendJSONString().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 209 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("plain") |
| 210 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("with \"quotes\" and \\slashes") |
| 211 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("html <&> bits") |
| 212 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("controls \x00\x1f\x7f") |
| 213 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("caf\xc3\xa9 \xe2\x80\xa8 \xe2\x80\xa9") |
| 214 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("broken \xff\xc3( utf8 \xc3") |
| 215 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("") |
| 216 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 217 | want, err := jsonscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/.Marshalscip-go gomod github.com/golang/go/src go1.25.0 `encoding/json`/Marshal().(s) |
| 218 | if err != nil { |
| 219 | t.Skipfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Skipf().("json.Marshal(%q) failed: %v", s, err) |
| 220 | } |
| 221 | if got := string(AppendJSONStringscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendJSONString().(nil, s)); got != string(want) { |
| 222 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("AppendJSONString(%q) = %q, want %q", s, got, want) |
| 223 | } |
| 224 | if got := string(AppendJSONStringscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/AppendJSONString().(nil, []byte(s))); got != string(want) { |
| 225 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("AppendJSONString(bytes %q) = %q, want %q", s, got, want) |
| 226 | } |
| 227 | }) |
| 228 | } |
| 229 | |
| 230 | func FuzzParseIPscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzParseIP().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 231 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("127.0.0.1") |
| 232 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("01.2.3.4") |
| 233 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("255.255.255.256") |
| 234 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("::ffff:1.2.3.4") |
| 235 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("1:2:3:4:5:6:7::") |
| 236 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("1::2::3") |
| 237 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("fe80::1%eth0") |
| 238 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("12345::") |
| 239 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().(":::") |
| 240 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("") |
| 241 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 242 | want, wantErr := netipscip-go gomod github.com/golang/go/src go1.25.0 `net/netip`/.ParseAddrscip-go gomod github.com/golang/go/src go1.25.0 `net/netip`/ParseAddr().(s) |
| 243 | hasColon := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.ContainsRunescip-go gomod github.com/golang/go/src go1.25.0 strings/ContainsRune().(s, ':') |
| 244 | |
| 245 | got4, ok4 := ParseIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseIPv4().(s) |
| 246 | if want4 := wantErr == nil && !hasColon; ok4 != want4 { |
| 247 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseIPv4(%q) ok = %v, want %v (netip err: %v)", s, ok4, want4, wantErr) |
| 248 | } else if want4 && got4 != want { |
| 249 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseIPv4(%q) = %v, want %v", s, got4, want) |
| 250 | } |
| 251 | if _, okBytes := ParseIPv4scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseIPv4().([]byte(s)); okBytes != ok4 { |
| 252 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseIPv4(bytes %q) diverges from string form", s) |
| 253 | } |
| 254 | |
| 255 | got6, ok6 := ParseIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseIPv6().(s) |
| 256 | if want6 := wantErr == nil && hasColon; ok6 != want6 { |
| 257 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseIPv6(%q) ok = %v, want %v (netip err: %v)", s, ok6, want6, wantErr) |
| 258 | } else if want6 && got6 != want { |
| 259 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseIPv6(%q) = %v, want %v", s, got6, want) |
| 260 | } |
| 261 | if _, okBytes := ParseIPv6scip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/ParseIPv6().([]byte(s)); okBytes != ok6 { |
| 262 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("ParseIPv6(bytes %q) diverges from string form", s) |
| 263 | } |
| 264 | }) |
| 265 | } |
| 266 | |
| 267 | func FuzzCanonicalHeaderKeyscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzCanonicalHeaderKey().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 268 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("content-type") |
| 269 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("Content-Type") |
| 270 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("x--double--dash") |
| 271 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("-leading") |
| 272 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("bad key") |
| 273 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("non-ascii-\xc3\xa9") |
| 274 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("") |
| 275 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 276 | want := httpscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/.CanonicalHeaderKeyscip-go gomod github.com/golang/go/src go1.25.0 `net/http`/CanonicalHeaderKey().(s) |
| 277 | if got := CanonicalHeaderKeyscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/CanonicalHeaderKey().(s); got != want { |
| 278 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("CanonicalHeaderKey(%q) = %q, want %q", s, got, want) |
| 279 | } |
| 280 | if got := string(CanonicalHeaderKeyscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/CanonicalHeaderKey().([]byte(s))); got != want { |
| 281 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("CanonicalHeaderKey(bytes %q) = %q, want %q", s, got, want) |
| 282 | } |
| 283 | }) |
| 284 | } |
| 285 | |
| 286 | func FuzzIndexNonQuotablescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/FuzzIndexNonQuotable().(f *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Fscip-go gomod github.com/golang/go/src go1.25.0 testing/F#) { |
| 287 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("a\tb") |
| 288 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("aaaaaaaa\t\x1f") |
| 289 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("\xff\xff\xff\xff\xff\xff\xff\"") |
| 290 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("caf\xc3\xa9 r\xc3\xa9sum\xc3\xa9.pdf") |
| 291 | f.Addscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Add().("name\\quoted") |
| 292 | f.Fuzzscip-go gomod github.com/golang/go/src go1.25.0 testing/F#Fuzz().(func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#, s string) { |
| 293 | want := refIndexNonQuotablescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/refIndexNonQuotable().(s) |
| 294 | if got := IndexNonQuotablescip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IndexNonQuotable().(s); got != want { |
| 295 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("IndexNonQuotable(%q) = %d, want %d", s, got, want) |
| 296 | } |
| 297 | if got, wantASCII := IsASCIIscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/IsASCII().(s), isASCIIRefscip-go gomod github.com/gofiber/utils/v2 . `github.com/gofiber/utils/v2`/isASCIIRef().(s); got != wantASCII { |
| 298 | t.Fatalfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Fatalf().("IsASCII(%q) = %v, want %v", s, got, wantASCII) |
| 299 | } |
| 300 | }) |
| 301 | } |