summaryrefslogtreecommitdiff
path: root/regexec.c
diff options
context:
space:
mode:
authormame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-19 14:21:15 (GMT)
committermame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-19 14:21:15 (GMT)
commita4195fc99bc267da58612407737c91498f9d5f6d (patch)
tree127ad837d44af1087137a5ad444732794fe3a056 /regexec.c
parent67d0fbd03f46edcc0a6fb2a65409ebfa6be25534 (diff)
* regexec.c (slow_search): check the case when the length is 1.
The behavior of memcmp is undefined if the third argument is 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@16482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regexec.c')
-rw-r--r--regexec.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/regexec.c b/regexec.c
index a2d6993..684c5c8 100644
--- a/regexec.c
+++ b/regexec.c
@@ -2765,7 +2765,7 @@ slow_search(OnigEncoding enc, UChar* target, UChar* target_end,
if (*s == *target) {
p = s + 1;
t = target + 1;
- if (memcmp(t, p, target_end - t) == 0)
+ if (target_end == t || memcmp(t, p, target_end - t) == 0)
return s;
}
s += n;
@@ -2776,7 +2776,7 @@ slow_search(OnigEncoding enc, UChar* target, UChar* target_end,
if (*s == *target) {
p = s + 1;
t = target + 1;
- if (memcmp(t, p, target_end - t) == 0)
+ if (target_end == t || memcmp(t, p, target_end - t) == 0)
return s;
}
s += enclen(enc, s, end);