From: Justin Viiret Date: Mon, 4 Jan 2016 02:42:21 +0000 (+1100) Subject: roseFlushLastByteHistory: iter state on stack X-Git-Tag: v4.2.0^2~200 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=09319940bf3fb701c36137ed4f3acb9a0e0ab592;p=thirdparty%2Fvectorscan.git roseFlushLastByteHistory: iter state on stack --- diff --git a/src/rose/match.h b/src/rose/match.h index 86e22183..19a07c9a 100644 --- a/src/rose/match.h +++ b/src/rose/match.h @@ -268,8 +268,6 @@ void update_depth(struct RoseContext *tctxt, u8 depth) { tctxt->depth = d; } -/* Note: uses the stashed sparse iter state; cannot be called from - * anybody else who is using it */ static rose_inline void roseFlushLastByteHistory(const struct RoseEngine *t, u8 *state, u64a currEnd, struct RoseContext *tctxt) { @@ -289,13 +287,16 @@ void roseFlushLastByteHistory(const struct RoseEngine *t, u8 *state, DEBUG_PRINTF("flushing\n"); - const struct mmbit_sparse_iter *it - = (const void *)((const char *)t + t->lastByteHistoryIterOffset); + const struct mmbit_sparse_iter *it = + getByOffset(t, t->lastByteHistoryIterOffset); + assert(ISALIGNED(it)); + const u32 numStates = t->rolesWithStateCount; void *role_state = getRoleState(state); - mmbit_sparse_iter_unset(role_state, numStates, it, - scratch->sparse_iter_state); + struct mmbit_sparse_state si_state[MAX_SPARSE_ITER_STATES]; + + mmbit_sparse_iter_unset(role_state, numStates, it, si_state); } #endif