diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-27 11:09:41 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-27 11:09:41 +0000 |
commit | b8b0f6fd46840d90a22d2c75bf823d31aa62cc18 (patch) | |
tree | 13b8b1c22617281c85e378114a7957820465e645 /string.c | |
parent | 36b4d1a1dc0a160a08994fd6f165b46863ecc65b (diff) | |
download | ruby-b8b0f6fd46840d90a22d2c75bf823d31aa62cc18.tar.gz |
* string.c (rb_str_inspect): avoid exception by
"\#\xa1".force_encoding("euc-jp").inspect.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@15272 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -3311,9 +3311,11 @@ rb_str_inspect(VALUE str) p += n; if (c == '"'|| c == '\\' || - (c == '#' && p < pend && - (cc = rb_enc_codepoint(p,pend,enc), - (cc == '$' || cc == '@' || cc == '{')))) { + (c == '#' && + p < pend && + MBCLEN_CHARFOUND(rb_enc_precise_mbclen(p,pend,enc)) && + (cc = rb_enc_codepoint(p,pend,enc), + (cc == '$' || cc == '@' || cc == '{')))) { prefix_escape(result, c, enc); } else if (c == '\n') { |