Verified Commit f996d6ce authored by jkvis's avatar jkvis

Fixed invalid memory access for very small strings

parent c07e2636
......@@ -808,7 +808,7 @@ static sais_index_type sais_main(const void *T, sais_index_type *SA,
//Compute the LCP naively. This is only done if the instance is very simple
//and most likely constructed. Still this could be done by a more efficient
//algorithm (phi-algorithm).
for(i = 0; i < n; ++i){
for(i = 1; i < n; ++i){
p = 0;
while (chr(SA[i - 1] + p) == chr(SA[i] + p)) { ++p; }
LCP[i] = p;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment