1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

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
This commit is contained in:
nobu 2014-11-06 14:55:20 +00:00
parent 1ae1164eb0
commit c58962d43f
2 changed files with 9 additions and 1 deletions

View file

@ -1,3 +1,8 @@
Thu Nov 6 23:55:18 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (sym_printable): QUOTE() should not raise an exception
even on invalid byte sequence.
Thu Nov 6 21:44:36 2014 Tanaka Akira <akr@fsij.org> Thu Nov 6 21:44:36 2014 Tanaka Akira <akr@fsij.org>
* test/test_unicode_normalize.rb: Rename TestNormalize to * test/test_unicode_normalize.rb: Rename TestNormalize to

View file

@ -8497,8 +8497,11 @@ sym_printable(const char *s, const char *send, rb_encoding *enc)
{ {
while (s < send) { while (s < send) {
int n; 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; if (!rb_enc_isprint(c, enc)) return FALSE;
s += n; s += n;
} }