Przeglądaj źródła

Fix: core panics when zero domain/full type of rule (#786)

DarthVader 4 lat temu
rodzic
commit
c71ae9b310
1 zmienionych plików z 4 dodań i 0 usunięć
  1. 4 0
      common/strmatcher/mph_matcher.go

+ 4 - 0
common/strmatcher/mph_matcher.go

@@ -94,6 +94,10 @@ func (g *MphMatcherGroup) Build() {
 		g.ac.Build()
 	}
 	keyLen := len(*g.ruleMap)
+	if keyLen == 0 {
+		keyLen = 1
+		(*g.ruleMap)["empty___"] = RollingHash("empty___")
+	}
 	g.level0 = make([]uint32, nextPow2(keyLen/4))
 	g.level0Mask = len(g.level0) - 1
 	g.level1 = make([]uint32, nextPow2(keyLen))