ruby-changes:42262
From: nagachika <ko1@a...>
Date: Tue, 29 Mar 2016 01:41:21 +0900 (JST)
Subject: [ruby-changes:42262] nagachika:r54336 (ruby_2_2): merge revision(s) 54210: [Backport #12204]
nagachika 2016-03-29 01:41:15 +0900 (Tue, 29 Mar 2016) New Revision: 54336 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54336 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_2/ Modified files: branches/ruby_2_2/ChangeLog branches/ruby_2_2/string.c branches/ruby_2_2/test/ruby/test_m17n.rb branches/ruby_2_2/version.h Index: ruby_2_2/ChangeLog =================================================================== --- ruby_2_2/ChangeLog (revision 54335) +++ ruby_2_2/ChangeLog (revision 54336) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/ChangeLog#L1 +Tue Mar 29 01:41:10 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] + Tue Mar 29 01:27:52 2016 Victor Nawothnig <Victor.Nawothnig@g...> * parse.y (parse_numvar): NTH_REF must be less than a half of Index: ruby_2_2/test/ruby/test_m17n.rb =================================================================== --- ruby_2_2/test/ruby/test_m17n.rb (revision 54335) +++ ruby_2_2/test/ruby/test_m17n.rb (revision 54336) @@ -1632,4 +1632,9 @@ class TestM17N < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_2/test/ruby/test_m17n.rb#L1632 assert_match(escape_plain, 0x5b.chr(::Encoding::UTF_8), bug10670) assert_match(escape_plain, 0x5b.chr, bug10670) 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_2/version.h =================================================================== --- ruby_2_2/version.h (revision 54335) +++ ruby_2_2/version.h (revision 54336) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_2/version.h#L1 #define RUBY_VERSION "2.2.5" #define RUBY_RELEASE_DATE "2016-03-29" -#define RUBY_PATCHLEVEL 278 +#define RUBY_PATCHLEVEL 279 #define RUBY_RELEASE_YEAR 2016 #define RUBY_RELEASE_MONTH 3 Index: ruby_2_2/string.c =================================================================== --- ruby_2_2/string.c (revision 54335) +++ ruby_2_2/string.c (revision 54336) @@ -3241,6 +3241,10 @@ enc_succ_alnum_char(char *p, long len, r https://github.com/ruby/ruby/blob/trunk/ruby_2_2/string.c#L3241 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; @@ -3250,11 +3254,13 @@ enc_succ_alnum_char(char *p, long len, r https://github.com/ruby/ruby/blob/trunk/ruby_2_2/string.c#L3254 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; Property changes on: ruby_2_2 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r54210 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/