mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@54384 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
ba57632186
commit
9d502cf9a4
4 changed files with 23 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
Tue Mar 29 16:54:14 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* 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 16:45:58 2016 Victor Nawothnig <Victor.Nawothnig@gmail.com>
|
||||
|
||||
* parse.y (parse_numvar): NTH_REF must be less than a half of
|
||||
|
|
6
string.c
6
string.c
|
@ -3475,6 +3475,10 @@ enc_succ_alnum_char(char *p, long len, rb_encoding *enc, char *carry)
|
|||
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;
|
||||
|
@ -3484,12 +3488,14 @@ enc_succ_alnum_char(char *p, long len, rb_encoding *enc, char *carry)
|
|||
return NEIGHBOR_NOT_CHAR;
|
||||
|
||||
MEMCPY(save, p, char, len);
|
||||
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;
|
||||
while (1) {
|
||||
|
|
|
@ -1682,4 +1682,9 @@ class TestM17N < Test::Unit::TestCase
|
|||
end
|
||||
assert_equal(e("[\"\xB4\xC1\xBB\xFA\"]"), s, bug11787)
|
||||
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
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
#define RUBY_VERSION "2.3.0"
|
||||
#define RUBY_RELEASE_DATE "2016-03-29"
|
||||
#define RUBY_PATCHLEVEL 40
|
||||
#define RUBY_PATCHLEVEL 41
|
||||
|
||||
#define RUBY_RELEASE_YEAR 2016
|
||||
#define RUBY_RELEASE_MONTH 3
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue