diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-09 02:04:10 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-03-09 02:04:10 +0000 |
commit | 4171ed6c21a36d88cfc5fe5152a6b58a75cf6240 (patch) | |
tree | 7e2e4ce7c0bd435f00c4f26e79f023782fd6f67a /regenc.h | |
parent | e65c9bd17749dc50f5ebd514dd6fc1d6ee99643b (diff) |
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.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57816 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] |