]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
rose: call loadLongLiteralState() earlier
authorJustin Viiret <justin.viiret@intel.com>
Thu, 29 Sep 2016 00:29:42 +0000 (10:29 +1000)
committerMatthew Barr <matthew.barr@intel.com>
Fri, 2 Dec 2016 00:23:14 +0000 (11:23 +1100)
The ll_buf, ll_buf_nocase buffers must be initialised before anyh path
that could lead to storeLongLiteralState().

src/rose/stream.c

index 703c09403b8b6c31fbb1af663275b295bc7cfeae..9599612f0e331f7a7d3cd0bf863aa4756a051d63 100644 (file)
@@ -580,6 +580,12 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
 
     const struct HWLM *ftable = getFLiteralMatcher(t);
     if (ftable) {
+        // Load in long literal table state and set up "fake history" buffers
+        // (ll_buf, etc, used by the CHECK_LONG_LIT instruction). Note that this
+        // must be done here in order to ensure that it happens before any path
+        // that leads to storeLongLiteralState(), which relies on these buffers.
+        loadLongLiteralState(t, state, scratch);
+
         if (t->noFloatingRoots && !roseHasInFlightMatches(t, state, scratch)) {
             DEBUG_PRINTF("skip FLOATING: no inflight matches\n");
             goto flush_delay_and_exit;
@@ -591,8 +597,6 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
                 MIN(t->floatingDistance, length + offset) - offset : 0;
         }
 
-        loadLongLiteralState(t, state, scratch);
-
         size_t hlength = scratch->core_info.hlen;
 
         char rebuild = hlength &&