ruby-changes:42208
From: usa <ko1@a...>
Date: Fri, 25 Mar 2016 18:41:56 +0900 (JST)
Subject: [ruby-changes:42208] usa:r54284 (ruby_2_1): merge revision(s) 54210: [Backport #12204]
usa 2016-03-25 18:41:52 +0900 (Fri, 25 Mar 2016) New Revision: 54284 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54284 Log: merge revision(s) 54210: [Backport #12204] * string.c (enc_succ_alnum_char): try to skip an invalid character gap between GREEK CAPITAL RHO and SIGMA. [ruby-core:74478] [Bug #12204] Modified directories: branches/ruby_2_1/ Modified files: branches/ruby_2_1/ChangeLog branches/ruby_2_1/string.c branches/ruby_2_1/test/ruby/test_m17n.rb branches/ruby_2_1/version.h Index: ruby_2_1/test/ruby/test_m17n.rb =================================================================== --- ruby_2_1/test/ruby/test_m17n.rb (revision 54283) +++ ruby_2_1/test/ruby/test_m17n.rb (revision 54284) @@ -1613,4 +1613,9 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_1/test/ruby/test_m17n.rb#L1613 assert_same(str, str.scrub!) assert_equal("\uFFFD\uFFFD\uFFFD", str) end + + def test_greek_capital_gap + bug12204 = '[ruby-core:74478] [Bug #12204] GREEK CAPITAL RHO and SIGMA' + assert_equal("\u03A3", "\u03A1".succ, bug12204) + end end Index: ruby_2_1/version.h =================================================================== --- ruby_2_1/version.h (revision 54283) +++ ruby_2_1/version.h (revision 54284) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/version.h#L1 #define RUBY_VERSION "2.1.9" #define RUBY_RELEASE_DATE "2016-03-25" -#define RUBY_PATCHLEVEL 481 +#define RUBY_PATCHLEVEL 482 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_1/string.c =================================================================== --- ruby_2_1/string.c (revision 54283) +++ ruby_2_1/string.c (revision 54284) @@ -3179,6 +3179,10 @@ enc_succ_alnum_char(char *p, long len, r https://github.com/ruby/ruby/blob/trunk/ruby_2_1/string.c#L3179 int range; char save[ONIGENC_CODE_TO_MBC_MAXLEN]; + /* skip 03A2, invalid char between GREEK CAPITAL LETTERS */ + int try; + const int max_gaps = 1; + c = rb_enc_mbc_to_codepoint(p, p+len, enc); if (rb_enc_isctype(c, ONIGENC_CTYPE_DIGIT, enc)) ctype = ONIGENC_CTYPE_DIGIT; @@ -3188,11 +3192,13 @@ enc_succ_alnum_char(char *p, long len, r https://github.com/ruby/ruby/blob/trunk/ruby_2_1/string.c#L3192 return NEIGHBOR_NOT_CHAR; MEMCPY(save, p, char, len); - ret = enc_succ_char(p, len, enc); - if (ret == NEIGHBOR_FOUND) { - c = rb_enc_mbc_to_codepoint(p, p+len, enc); - if (rb_enc_isctype(c, ctype, enc)) - return NEIGHBOR_FOUND; + for (try = 0; try <= max_gaps; ++try) { + ret = enc_succ_char(p, len, enc); + if (ret == NEIGHBOR_FOUND) { + c = rb_enc_mbc_to_codepoint(p, p+len, enc); + if (rb_enc_isctype(c, ctype, enc)) + return NEIGHBOR_FOUND; + } } MEMCPY(p, save, char, len); range = 1; Index: ruby_2_1/ChangeLog =================================================================== --- ruby_2_1/ChangeLog (revision 54283) +++ ruby_2_1/ChangeLog (revision 54284) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_1/ChangeLog#L1 +Fri Mar 25 18:41:14 2016 Nobuyoshi Nakada <nobu@r...> + + * string.c (enc_succ_alnum_char): try to skip an invalid character + gap between GREEK CAPITAL RHO and SIGMA. + [ruby-core:74478] [Bug #12204] + Fri Mar 25 18:38:42 2016 NARUSE, Yui <naruse@r...> * enc/trans/JIS: update Unicode's notice. [Bug #11844] Property changes on: ruby_2_1 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r54210 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/