]> git.ipfire.org Git - thirdparty/vectorscan.git/commitdiff
assignStringsToBuckets: assert that there are lits
authorJustin Viiret <justin.viiret@intel.com>
Thu, 29 Oct 2015 22:33:04 +0000 (09:33 +1100)
committerMatthew Barr <matthew.barr@intel.com>
Tue, 10 Nov 2015 03:25:04 +0000 (14:25 +1100)
src/fdr/fdr_compile.cpp

index 8d658ccdad5fb374097f082962f477f2a6e32b07..8f1f3e03b0e24f1a0d8c475267034adf53ae3a3d 100644 (file)
@@ -245,6 +245,8 @@ void FDRCompiler::assignStringsToBuckets() {
     typedef pair<SCORE, u32> SCORE_INDEX_PAIR;
 
     u32 ls = verify_u32(lits.size());
+    assert(ls); // Shouldn't be called with no literals.
+
     // make a vector that contains our literals as pointers or u32 LiteralIndex values
     vector<LiteralIndex> vli;
     vli.resize(ls);
@@ -292,6 +294,8 @@ void FDRCompiler::assignStringsToBuckets() {
             currentChunk++;
         }
     }
+
+    assert(currentChunk > 0);
     count[currentChunk - 1] = ls - chunkStartID;
     // close off chunks with an empty row
     firstIds[currentChunk] = ls;