Explorar el Código

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

DarthVader hace 5 años
padre
commit
c71ae9b310
Se han modificado 1 ficheros con 4 adiciones y 0 borrados
  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))