summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/re.c b/re.c
index 7ab7ad211b..98cead68f2 100644
--- a/re.c
+++ b/re.c
@@ -144,7 +144,7 @@ rb_memsearch_qs(const unsigned char *xs, long m, const unsigned char *ys, long n
for (; x < xe; ++x)
qstable[*x] = xe - x;
/* Searching */
- for (; y < ye; y += *(qstable + y[m])) {
+ for (; y + m < ye; y += *(qstable + y[m])) {
if (*xs == *y && memcmp(xs, y, m) == 0)
return y - ys;
}