diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-04 06:13:48 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-10-04 06:13:48 +0000 |
commit | db152cd2dd986a88a193c6dc0195988f9aafb3af (patch) | |
tree | c675dd6c26c037a2473f64c0efb784469be921b8 | |
parent | 5f0bb43434fe0fe24acf3b68f30962970f4f7376 (diff) |
* enc/euc_jp.c (mbc_case_fold): check given string is valid or not,
and if invalid, return 1. [Bug #11486]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52016 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | enc/euc_jp.c | 5 |
2 files changed, 8 insertions, 2 deletions
@@ -1,3 +1,8 @@ +Sun Oct 4 15:11:48 2015 NARUSE, Yui <naruse@ruby-lang.org> + + * enc/euc_jp.c (mbc_case_fold): check given string is valid or not, + and if invalid, return 1. [Bug #11486] + Sun Oct 4 10:09:57 2015 Nobuyoshi Nakada <nobu@ruby-lang.org> * dir.c (rb_dir_getwd): normalize OS path to UTF-8 on OS X. diff --git a/enc/euc_jp.c b/enc/euc_jp.c index d0852c3daa..3088dfd64b 100644 --- a/enc/euc_jp.c +++ b/enc/euc_jp.c @@ -378,11 +378,12 @@ mbc_case_fold(OnigCaseFoldType flag, return 1; } else { - OnigCodePoint code; int len; + len = mbc_enc_len(p, end, enc); + if (len <= 0) return 1; code = get_lower_case(mbc_to_code(p, end, enc)); - len = code_to_mbc(code, lower, enc); + /* assuming case folding in euc-jp doesn't change length */ (*pp) += len; return len; /* return byte length of converted char to lower */ } |