Fix insufficient slice check (#2755)

This commit is contained in:
raymonder jin
2021-06-25 13:22:01 +08:00
committed by GitHub
parent f2bbdfe9f2
commit 1d0f938f28
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -717,6 +717,19 @@ func TestTreeInvalidNodeType(t *testing.T) {
}
}
func TestTreeInvalidParamsType(t *testing.T) {
tree := &node{}
tree.wildChild = true
tree.children = append(tree.children, &node{})
tree.children[0].nType = 2
// set invalid Params type
params := make(Params, 0, 0)
// try to trigger slice bounds out of range with capacity 0
tree.getValue("/test", &params, false)
}
func TestTreeWildcardConflictEx(t *testing.T) {
conflicts := [...]struct {
route string