summaryrefslogtreecommitdiff
path: root/re.c
diff options
context:
space:
mode:
Diffstat (limited to 're.c')
-rw-r--r--re.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/re.c b/re.c
index 97803d4..8fa1abc 100644
--- a/re.c
+++ b/re.c
@@ -126,6 +126,9 @@ rb_memsearch_ss(const unsigned char *xs, long m, const unsigned char *ys, long n
if (m > SIZEOF_VALUE)
rb_bug("!!too long pattern string!!");
+ if (!(y = memchr(y, *x, n - m + 1)))
+ return -1;
+
/* Prepare hash value */
for (hx = *x++, hy = *y++; x < xe; ++x, ++y) {
hx <<= CHAR_BIT;