diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-12 17:22:20 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-12 17:22:20 +0000 |
commit | acfebb41ddea04ded300bc1c1aedbf7ebebcf276 (patch) | |
tree | 6d208ca08010e32768aa876a1be60713410dd682 /regenc.h | |
parent | 1b60a978a2cb67a2ea5423d5bed3a1d6edbb2eaf (diff) |
merge revision(s) 57816,57817: [Backport #13292]
fix UTF-32 valid_encoding?
* enc/utf_32be.c (utf32be_mbc_enc_len): check arguments precisely.
[ruby-core:79966] [Bug #13292]
* enc/utf_32le.c (utf32le_mbc_enc_len): ditto.
* regenc.h (UNICODE_VALID_CODEPOINT_P): predicate for valid
Unicode codepoints.
fix UTF-32 valid_encoding?
* test/ruby/test_io_m17n.rb (TestIO_M17N#test_puts_widechar): do
not use invalid codepoint. [ruby-core:79966] [Bug #13292]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_4@57935 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'regenc.h')
-rw-r--r-- | regenc.h | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -186,6 +186,9 @@ ONIG_EXTERN int onigenc_unicode_apply_all_case_fold(OnigCaseFoldType flag, OnigA #define UTF16_IS_SURROGATE_FIRST(c) (((c) & 0xfc) == 0xd8) #define UTF16_IS_SURROGATE_SECOND(c) (((c) & 0xfc) == 0xdc) #define UTF16_IS_SURROGATE(c) (((c) & 0xf8) == 0xd8) +#define UNICODE_VALID_CODEPOINT_P(c) ( \ + ((c) <= 0x10ffff) && \ + !((c) < 0x10000 && UTF16_IS_SURROGATE((c) >> 8))) #define ONIGENC_ISO_8859_1_TO_LOWER_CASE(c) \ OnigEncISO_8859_1_ToLowerCaseTable[c] |