Skip to content

Commit

Permalink
Merge pull request #33 from lxylxy123456/rabin
Browse files Browse the repository at this point in the history
Fix invalid memory access in RabinKarpMatcher
  • Loading branch information
lxylxy123456 committed Dec 18, 2020
2 parents dc1de13 + 24fe9c8 commit 13d4451
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/RabinKarpMatcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ template <typename T>
void RabinKarpMatcher(const std::vector<T>& S, const std::vector<T>& P,
size_t d, size_t q, T o, std::vector<size_t>& ans) {
size_t n = S.size(), m = P.size();
if (n < m)
return;
size_t h = ModularExponentiation(d, m - 1, q);
size_t p = 0, t = 0;
for (size_t i = 0; i < m; i++) {
Expand Down

0 comments on commit 13d4451

Please sign in to comment.