-
Notifications
You must be signed in to change notification settings - Fork 81
Open
Description
https://github.com/timtadh/data-structures/blob/master/trie/tst.go#L173
This line panics if the prefix being searched for is longer than the capacity of the key being checked, e.g. this panics:
tst := trie.New()
tst.Put([]byte("abc"), nil)
_, _, _ = tst.PrefixFind([]byte("abcxxxxxxxxxxxxxxxxxxxx"))()
panic: runtime error: slice bounds out of range [:23] with capacity 8
...
github.com/timtadh/data-structures/trie.(*TST).PrefixFind(0xc000092760?, {0xc000092749, 0x17, 0x3?})
/go/pkg/mod/github.com/timtadh/[email protected]/trie/tst.go:173 +0x297
...
Since the slice operation succeeds if the index is larger than the length but smaller than the capacity this doesn't always occur for prefixes that are slightly longer than the found leaf node.
Metadata
Metadata
Assignees
Labels
No labels