From 8cadba0bdd8c61de0b93250049dbd09fce76962a Mon Sep 17 00:00:00 2001 From: Justin Viiret Date: Thu, 29 Sep 2016 10:29:42 +1000 Subject: [PATCH] rose: call loadLongLiteralState() earlier The ll_buf, ll_buf_nocase buffers must be initialised before anyh path that could lead to storeLongLiteralState(). --- src/rose/stream.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/rose/stream.c b/src/rose/stream.c index 703c0940..9599612f 100644 --- a/src/rose/stream.c +++ b/src/rose/stream.c @@ -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 &&