]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
assert program offsets are non-zero
authorJustin Viiret <justin.viiret@intel.com>
Tue, 31 Jan 2017 23:37:15 +0000 (10:37 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 26 Apr 2017 04:56:49 +0000 (14:56 +1000)
src/rose/match.c

index c7c73d2577c4da9ba2d2d27f1ebb35bbed8933fd..488ee5d57e51d1e0654167c61473e91d66856295 100644 (file)
@@ -85,7 +85,7 @@ hwlmcb_rv_t roseDelayRebuildCallback(size_t start, size_t end, u32 id,
 
     DEBUG_PRINTF("STATE groups=0x%016llx\n", tctx->groups);
 
-    assert(id < t->size); // id is a program offset
+    assert(id && id < t->size); // id is a program offset
     const u64a som = 0;
     const size_t match_len = end - start + 1;
     const u8 flags = 0;
@@ -236,10 +236,10 @@ int roseAnchoredCallback(u64a start, u64a end, u32 id, void *ctx) {
  */
 static really_inline
 hwlmcb_rv_t roseProcessMatchInline(const struct RoseEngine *t,
-                             struct hs_scratch *scratch, u64a end,
-                             size_t match_len, u32 id) {
+                                   struct hs_scratch *scratch, u64a end,
+                                   size_t match_len, u32 id) {
     DEBUG_PRINTF("id=%u\n", id);
-    assert(id < t->size); // id is an offset into bytecode
+    assert(id && id < t->size); // id is an offset into bytecode
     const u64a som = 0;
     const u8 flags = 0;
     return roseRunProgram_i(t, scratch, id, som, end, match_len, flags);