From 800f04c6a521c007e9837813b3564ae6b491e31c Mon Sep 17 00:00:00 2001 From: naruse Date: Sun, 8 Jan 2012 20:42:45 +0000 Subject: * numeric.c (rb_enc_uint_char): raise RangeError when added codepoint is invalid. [Feature #5855] [Bug #5863] [Bug #5864] * string.c (rb_str_concat): ditto. * string.c (rb_str_concat): set encoding as ASCII-8BIT when the string is US-ASCII and the argument is an integer greater than 127. * regenc.c (onigenc_mb2_code_to_mbclen): rearrange error code. * enc/euc_jp.c (code_to_mbclen): ditto. * enc/shift_jis.c (code_to_mbclen): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@34236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- regenc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'regenc.c') diff --git a/regenc.c b/regenc.c index 32d24e76d9..70b56ef727 100644 --- a/regenc.c +++ b/regenc.c @@ -732,8 +732,9 @@ onigenc_mbn_is_mbc_ambiguous(OnigEncoding enc, OnigCaseFoldType flag, extern int onigenc_mb2_code_to_mbclen(OnigCodePoint code, OnigEncoding enc ARG_UNUSED) { - if ((code & 0xff00) != 0) return 2; - else return 1; + if (code <= 0xff) return 1; + if (code <= 0xffff) return 2; + return ONIGERR_TOO_BIG_WIDE_CHAR_VALUE; } extern int -- cgit v1.2.3