diff options
| -rw-r--r-- | ChangeLog | 5 | ||||
| -rw-r--r-- | dir.c | 4 |
2 files changed, 8 insertions, 1 deletions
@@ -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. @@ -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; |
