rose: call loadLongLiteralState() earlier

The ll_buf, ll_buf_nocase buffers must be initialised before anyh path
that could lead to storeLongLiteralState().
This commit is contained in:
Justin Viiret 2016-09-29 10:29:42 +10:00 committed by Matthew Barr
parent 924089d95e
commit 8cadba0bdd

View File

@ -580,6 +580,12 @@ void roseStreamExec(const struct RoseEngine *t, struct hs_scratch *scratch) {
const struct HWLM *ftable = getFLiteralMatcher(t); const struct HWLM *ftable = getFLiteralMatcher(t);
if (ftable) { 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)) { if (t->noFloatingRoots && !roseHasInFlightMatches(t, state, scratch)) {
DEBUG_PRINTF("skip FLOATING: no inflight matches\n"); DEBUG_PRINTF("skip FLOATING: no inflight matches\n");
goto flush_delay_and_exit; 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; MIN(t->floatingDistance, length + offset) - offset : 0;
} }
loadLongLiteralState(t, state, scratch);
size_t hlength = scratch->core_info.hlen; size_t hlength = scratch->core_info.hlen;
char rebuild = hlength && char rebuild = hlength &&