Skip to content

Commit 00930ce

Browse files
authored
Prevent potential computing overflow (TheAlgorithms#322)
1 parent 8e62d49 commit 00930ce

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/string/aho_corasick.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ impl AhoCorasick {
7777
}
7878
}
7979
for &len in &cur.borrow().lengths {
80-
ans.push(&s[i - len + 1..=i]);
80+
ans.push(&s[i + 1 - len..=i]);
8181
}
8282
}
8383
ans

0 commit comments

Comments
 (0)