summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--regexec.c4
2 files changed, 7 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1734339..290a58a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Mon May 19 23:19:35 2008 Yusuke Endoh <mame@tsg.ne.jp>
+
+ * regexec.c (slow_search): check the case when the length is 1.
+ The behavior of memcmp is undefined if the third argument is 0.
+
Mon May 19 21:07:48 2008 Koichi Sasada <ko1@atdot.net>
* thread_pthread.c (native_thread_apply_priority):
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);