From ebff65adc4e90a8affd8f95125d1e955906fbd99 Mon Sep 17 00:00:00 2001 From: William Ballenthin Date: Tue, 30 Jun 2020 00:46:19 -0600 Subject: [PATCH] rules: range: simplify logic --- capa/engine.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/capa/engine.py b/capa/engine.py index 0eb164f1..15a05796 100644 --- a/capa/engine.py +++ b/capa/engine.py @@ -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])