mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-16 19:14:41 -07:00
Don't panic on zero-length token from misformed subject
This commit is contained in:
@@ -290,7 +290,7 @@ func (s *Sublist) Remove(subject []byte, sub interface{}) {
|
||||
levels := lnts[:0]
|
||||
|
||||
for _, t := range toks {
|
||||
if l == nil {
|
||||
if l == nil || len(t) == 0 {
|
||||
s.mu.Unlock()
|
||||
return
|
||||
}
|
||||
|
||||
@@ -357,6 +357,15 @@ func TestResultSetSnapshots(t *testing.T) {
|
||||
verifyLen(r, 1, t)
|
||||
}
|
||||
|
||||
func TestBadSubjectOnRemove(t *testing.T) {
|
||||
bad := []byte("a.b..d")
|
||||
value := "bad"
|
||||
|
||||
s := New()
|
||||
s.Insert(bad, value)
|
||||
s.Remove(bad, value)
|
||||
}
|
||||
|
||||
// -- Benchmarks Setup --
|
||||
|
||||
var subs [][]byte
|
||||
|
||||
Reference in New Issue
Block a user