summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorCyrille Bagard <nocbos@gmail.com>2023-11-08 07:10:27 (GMT)
committerCyrille Bagard <nocbos@gmail.com>2023-11-08 07:10:27 (GMT)
commit72b6d6efcea936ac806528f3453a3107c7807131 (patch)
tree648d7e37e0c23243fa72cf1983a2210c70ea6011 /tests
parentf758049c3a8b06a0b35480327dc86c5da548a620 (diff)
Make the hexadecimal range processing stronger.
Diffstat (limited to 'tests')
-rw-r--r--tests/analysis/scan/fuzzing.py39
1 files changed, 38 insertions, 1 deletions
diff --git a/tests/analysis/scan/fuzzing.py b/tests/analysis/scan/fuzzing.py
index 5d99c35..1957f72 100644
--- a/tests/analysis/scan/fuzzing.py
+++ b/tests/analysis/scan/fuzzing.py
@@ -176,7 +176,9 @@ rule test {
}
'''
- self.check_rule_failure(rule)
+ with self.assertRaisesRegex(ValueError, 'Unable to create content scanner'):
+
+ scanner = ContentScanner(rule)
def testAllocations(self):
@@ -212,3 +214,38 @@ rule test {
'''
self.check_rule_success(rule, cnt)
+
+
+ def testValidHexRangeMerge(self):
+ """Merge valid hexadecimal ranges."""
+
+ rule = '''
+rule test {
+
+ bytes:
+ $a = { [0] ?? }
+
+ condition:
+ $a
+
+}
+'''
+
+ with self.assertRaisesRegex(ValueError, 'Unable to create content scanner'):
+
+ scanner = ContentScanner(rule)
+
+
+ rule = '''
+rule test {
+
+ bytes:
+ $a = { [2] ?? }
+
+ condition:
+ $a
+
+}
+'''
+
+ self.check_rule_failure(rule)