diff options
author | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-13 15:59:51 +0000 |
---|---|---|
committer | shyouhei <shyouhei@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-12-13 15:59:51 +0000 |
commit | 6de1532775ec9802acc71c2c8b21794309b479b9 (patch) | |
tree | d2bae3abf015e991aa3be3d729f4eb3109ca7fd2 /string.c | |
parent | cf6247135b197aa3951cd70e9e7219149c2f520a (diff) |
merge revision(s) 25515:
* string.c (rb_str_inspect): get rid of adding garbage to shor
UTF-8 string. [ruby-dev:39550]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8_7@26078 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'string.c')
-rw-r--r-- | string.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -2641,8 +2641,8 @@ rb_str_inspect(str) p = RSTRING(str)->ptr; pend = p + RSTRING(str)->len; while (p < pend) { char c = *p++; - if (ismbchar(c) && p < pend) { - int len = mbclen(c); + int len; + if (ismbchar(c) && p + (len = mbclen(c)) <= pend) { rb_str_buf_cat(result, p - 1, len); p += len - 1; } |