diff options
author | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-19 14:21:15 +0000 |
---|---|---|
committer | mame <mame@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-05-19 14:21:15 +0000 |
commit | 50373cfc34ff99e92c42ca9351b025c81a9ed0a2 (patch) | |
tree | 127ad837d44af1087137a5ad444732794fe3a056 /regexec.c | |
parent | 2e5247d4e8b4e18521d8ed0253e3ce31ab5a6cd1 (diff) | |
download | ruby-50373cfc34ff99e92c42ca9351b025c81a9ed0a2.tar.gz ruby-50373cfc34ff99e92c42ca9351b025c81a9ed0a2.tar.xz ruby-50373cfc34ff99e92c42ca9351b025c81a9ed0a2.zip |
* 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: http://svn.ruby-lang.org/repos/ruby/trunk@16482 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -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); |