From: Alex Coyte Date: Sun, 1 Nov 2015 23:28:31 +0000 (+1100) Subject: add asserts to make bounds on alphaShift clear X-Git-Tag: v4.1.0^2~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a255e6b67802a05a33acfde43f71a9b1824f8b81;p=thirdparty%2Fvectorscan.git add asserts to make bounds on alphaShift clear --- diff --git a/src/nfa/mcclellancompile.cpp b/src/nfa/mcclellancompile.cpp index 39d29359..f75d08b5 100644 --- a/src/nfa/mcclellancompile.cpp +++ b/src/nfa/mcclellancompile.cpp @@ -700,7 +700,10 @@ aligned_unique_ptr mcclellanCompile16(dfa_info &info, ReportID arb; u8 single; u32 accelCount; + u8 alphaShift = info.getAlphaShift(); + assert(alphaShift <= 8); + u16 count_real_states; if (allocateFSN16(info, &count_real_states)) { DEBUG_PRINTF("failed to allocate state numbers, %zu states total\n", @@ -843,6 +846,7 @@ void fillInBasicState8(const dfa_info &info, mstate_aux *aux, u8 *succ_table, const vector &reports_eod, u32 i) { dstate_id_t j = info.implId(i); u8 alphaShift = info.getAlphaShift(); + assert(alphaShift <= 8); for (size_t s = 0; s < info.impl_alpha_size; s++) { dstate_id_t raw_succ = info.states[i].next[s];