From f044b0444d72e04f0ec65db8ea192043af2a7998 Mon Sep 17 00:00:00 2001 From: Cyrille Bagard Date: Sun, 22 Oct 2023 14:36:33 +0200 Subject: Expect only one argument for the not operator, even in debug mode. --- src/analysis/scan/exprs/logical.c | 2 +- tests/analysis/scan/fuzzing.py | 15 +++++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/analysis/scan/exprs/logical.c b/src/analysis/scan/exprs/logical.c index c61a44c..3b07843 100644 --- a/src/analysis/scan/exprs/logical.c +++ b/src/analysis/scan/exprs/logical.c @@ -230,7 +230,7 @@ bool g_scan_logical_operation_create(GScanLogicalOperation *op, BooleanOperation g_object_ref(G_OBJECT(op->first)); result = (second == NULL); - assert(second != NULL); + assert(second == NULL); break; default: diff --git a/tests/analysis/scan/fuzzing.py b/tests/analysis/scan/fuzzing.py index 53227af..61f4117 100644 --- a/tests/analysis/scan/fuzzing.py +++ b/tests/analysis/scan/fuzzing.py @@ -108,3 +108,18 @@ rule test { ''' self.check_rule_failure(rule) + + + def testSelfReferencingRule(self): + """Expect only one argument for the not operator, even in debug mode.""" + + rule = ''' +rule test { + + condition: + not(0) + +} +''' + + self.check_rule_success(rule) -- cgit v0.11.2-87-g4458