]> git.ipfire.org Git - thirdparty/suricata-verify.git/commitdiff
test/byte-math: Add 0 divisor test. 1309/head
authorJeff Lucovsky <jlucovsky@oisf.net>
Thu, 30 Mar 2023 13:41:44 +0000 (09:41 -0400)
committerVictor Julien <victor@inliniac.net>
Wed, 12 Jul 2023 07:22:48 +0000 (09:22 +0200)
Issue: 5945

This commit adds a byte-math test with a zero divisor. Division by 0 is
undefined so there's no match.

tests/detect-bytemath-div-01/README.md [new file with mode: 0644]
tests/detect-bytemath-div-01/input.pcap [new file with mode: 0644]
tests/detect-bytemath-div-01/test.rules [new file with mode: 0644]
tests/detect-bytemath-div-01/test.yaml [new file with mode: 0644]

diff --git a/tests/detect-bytemath-div-01/README.md b/tests/detect-bytemath-div-01/README.md
new file mode 100644 (file)
index 0000000..8b06cb4
--- /dev/null
@@ -0,0 +1,11 @@
+Description
+===========
+Test byte_math payload keyword with a 0 division.
+
+PCAP
+====
+PCAP comes from the suricata verify test[detect-bytemath-01]
+
+Redmine ticket
+==============
+https://redmine.openinfosecfoundation.org/issues/5945
diff --git a/tests/detect-bytemath-div-01/input.pcap b/tests/detect-bytemath-div-01/input.pcap
new file mode 100644 (file)
index 0000000..4a18a07
Binary files /dev/null and b/tests/detect-bytemath-div-01/input.pcap differ
diff --git a/tests/detect-bytemath-div-01/test.rules b/tests/detect-bytemath-div-01/test.rules
new file mode 100644 (file)
index 0000000..0d74b52
--- /dev/null
@@ -0,0 +1,3 @@
+alert tcp any any -> any any (ipv4.hdr; byte_extract: 1, 2, extracted_val, relative;byte_math: bytes 1, offset 0, oper /, rvalue extracted_val, result var;msg:\
+"Byte extract and byte math with 0 devide\
+";sid:1;)
diff --git a/tests/detect-bytemath-div-01/test.yaml b/tests/detect-bytemath-div-01/test.yaml
new file mode 100644 (file)
index 0000000..230df0c
--- /dev/null
@@ -0,0 +1,10 @@
+requires:
+   files:
+       - src/detect-bytemath.c
+
+checks:
+  - filter:
+      count: 0
+      match:
+        event_type: alert
+        alert.signature_id: 1