diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-06 14:55:20 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-11-06 14:55:20 +0000 |
commit | c58962d43f3ae09782afaddfb3108270eef2929e (patch) | |
tree | 0d23d8a2a89ca6da16a4e997ae866b0fb151c859 /string.c | |
parent | 1ae1164eb0587c8f4ad1ab44bc1467c689c53b6c (diff) | |
download | ruby-c58962d43f3ae09782afaddfb3108270eef2929e.tar.gz |
string.c: no exception in QUOTE
* string.c (sym_printable): QUOTE() should not raise an exception
even on invalid byte sequence.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@48305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 5 |
1 files changed, 4 insertions, 1 deletions
@@ -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; } |