summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-04 12:30:33 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-05-04 12:30:33 +0000
commit885817ee3aa179165052c5d81cded144097a9077 (patch)
treef42c8cb352be84dc0c433b30b90318b821d22452
parent8032f0fde4182ab6153cb2abc98900fe1601c24f (diff)
merges r23190 from trunk into ruby_1_9_1.
-- * dir.c (fnmatch_helper): use rb_enc_precise_mbclen and fail if bytes are invalid. [ruby-dev:38307] git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_9_1@23337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--dir.c4
2 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e79038da..17a1d56d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Wed Apr 15 11:53:35 2009 NARUSE, Yui <naruse@ruby-lang.org>
+
+ * dir.c (fnmatch_helper): use rb_enc_precise_mbclen and
+ fail if bytes are invalid. [ruby-dev:38307]
+
Tue Apr 14 18:11:26 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dir.c (bracket): if same in bytes, path is matching.
diff --git a/dir.c b/dir.c
index f62fc416b..f27f04c40 100644
--- a/dir.c
+++ b/dir.c
@@ -224,7 +224,9 @@ fnmatch_helper(
RETURN(ISEND(p) ? 0 : FNM_NOMATCH);
if (ISEND(p))
goto failed;
- r = rb_enc_mbclen(p, pend, enc);
+ r = rb_enc_precise_mbclen(p, pend, enc);
+ if (!MBCLEN_CHARFOUND_P(r))
+ goto failed;
if (r <= (send-s) && memcmp(p, s, r) == 0) {
p += r;
s += r;