mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 15:16:51 +08:00
fix infinite loop when parsing specially-crafted headers (#521)
This commit is contained in:
@@ -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
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user