]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
add asserts to make bounds on alphaShift clear
authorAlex Coyte <a.coyte@intel.com>
Sun, 1 Nov 2015 23:28:31 +0000 (10:28 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 10 Nov 2015 03:25:05 +0000 (14:25 +1100)
src/nfa/mcclellancompile.cpp

index 39d2935915d19e042c37e66456ab00d306973b63..f75d08b54d63d7eab3fa0aead86c15ba6575d375 100644 (file)
@@ -700,7 +700,10 @@ aligned_unique_ptr<NFA> 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<u32> &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];