fix infinite loop when parsing specially-crafted headers (#521)

This commit is contained in:
Alessandro Ros
2024-02-21 23:36:35 +01:00
committed by GitHub
parent 4a8bcf3634
commit 55fa72f0c2
4 changed files with 18 additions and 29 deletions

View File

@@ -85,21 +85,8 @@ func TestKeyValParse(t *testing.T) {
}
}
func TestKeyValParseErrors(t *testing.T) {
for _, ca := range []struct {
name string
s string
err string
}{
{
"apexes not closed",
`key1="v,1`,
"apexes not closed (key1=\"v,1)",
},
} {
t.Run(ca.name, func(t *testing.T) {
_, err := keyValParse(ca.s, ',')
require.EqualError(t, err, ca.err)
})
}
func FuzzKeyValParse(f *testing.F) {
f.Fuzz(func(t *testing.T, b string) {
keyValParse(b, ',') //nolint:errcheck
})
}