]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: assert that program offset is sane
authorJustin Viiret <justin.viiret@intel.com>
Wed, 20 Apr 2016 02:41:02 +0000 (12:41 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Wed, 18 May 2016 06:22:01 +0000 (16:22 +1000)
src/rose/catchup.c
src/rose/program_runtime.h

index d6e7860c581f2e416d2a7040107ff90e4238420a..dba9629e26b9e07d1f7e7f7772460d0b1e748b21 100644 (file)
@@ -50,9 +50,6 @@ static really_inline
 int roseNfaRunProgram(const struct RoseEngine *rose, struct hs_scratch *scratch,
                       u64a som, u64a offset, ReportID id, const char from_mpv) {
     const u32 program = id;
-    assert(program > 0);
-    assert(program % ROSE_INSTR_MIN_ALIGN == 0);
-
     const size_t match_len = 0; // Unused in this path.
     const char in_anchored = 0;
     const char in_catchup = 1;
index be56bec7b36b767e96835b7e167ec714e3bfc19a..783970709edd5632272981dde995a55768d259e1 100644 (file)
@@ -830,7 +830,7 @@ hwlmcb_rv_t roseRunProgram(const struct RoseEngine *t,
                            char skip_mpv_catchup) {
     DEBUG_PRINTF("program=%u, offsets [%llu,%llu]\n", programOffset, som, end);
 
-    assert(programOffset);
+    assert(programOffset >= sizeof(struct RoseEngine));
     assert(programOffset < t->size);
 
     const char *pc_base = getByOffset(t, programOffset);