mirror of
https://github.com/mandiant/capa.git
synced 2026-01-09 11:45:20 -08:00
rules: range: simplify logic
This commit is contained in:
@@ -155,12 +155,8 @@ class Range(Statement):
|
||||
|
||||
def evaluate(self, ctx):
|
||||
count = len(ctx.get(self.child, []))
|
||||
if self.min == 0:
|
||||
if count == 0:
|
||||
return Result(True, self, [])
|
||||
elif self.child not in ctx:
|
||||
# self.min > 0 so there needs to be more than zero matches
|
||||
return Result(False, self, [])
|
||||
if self.min == 0 and count == 0:
|
||||
return Result(True, self, [])
|
||||
|
||||
return Result(self.min <= count <= self.max, self, [], locations=ctx[self.child])
|
||||
|
||||
|
||||
Reference in New Issue
Block a user