diff --git a/ChangeLog b/ChangeLog index 1315ad83f3..19c5db0273 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Nov 6 23:55:18 2014 Nobuyoshi Nakada + + * string.c (sym_printable): QUOTE() should not raise an exception + even on invalid byte sequence. + Thu Nov 6 21:44:36 2014 Tanaka Akira * test/test_unicode_normalize.rb: Rename TestNormalize to diff --git a/string.c b/string.c index 5c87424d18..84481dfe8c 100644 --- a/string.c +++ b/string.c @@ -8497,8 +8497,11 @@ sym_printable(const char *s, const char *send, rb_encoding *enc) { while (s < send) { int n; - int c = rb_enc_codepoint_len(s, send, &n, enc); + int c = rb_enc_precise_mbclen(s, send, enc); + if (!MBCLEN_CHARFOUND_P(c)) return FALSE; + n = MBCLEN_CHARFOUND_LEN(c); + c = rb_enc_mbc_to_codepoint(s, send, enc); if (!rb_enc_isprint(c, enc)) return FALSE; s += n; }