summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-15 02:50:07 +0000
committerusa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-12-15 02:50:07 +0000
commitd0c1160f7322b49091c546067c5888744aa4eef7 (patch)
treec670d111ada38b80a0cf9f78030259198d7aba5e
parent8ad9d4edbcf0ffdee1fedbecbf79b71cfbd4c006 (diff)
* string.c (rb_str_inspect): wrong result of UTF-8 inspect because of
the mistake of calculation. reported by eban via IRC. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@26103 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--string.c2
2 files changed, 6 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 23df84c71f..6b749f1194 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Dec 15 11:48:41 2009 NAKAMURA Usaku <usa@ruby-lang.org>
+
+ * string.c (rb_str_inspect): wrong result of UTF-8 inspect because of
+ the mistake of calculation. reported by eban via IRC.
+
Sun Dec 13 23:07:05 2009 NAKAMURA, Hiroshi <nahi@ruby-lang.org>
* test/openssl/*: added some tests from jruby-openssl.
diff --git a/string.c b/string.c
index 924b5e3c92..f1db4eb00d 100644
--- a/string.c
+++ b/string.c
@@ -2719,7 +2719,7 @@ rb_str_inspect(str)
while (p < pend) {
char c = *p++;
int len;
- if (ismbchar(c) && p + (len = mbclen(c)) <= pend) {
+ if (ismbchar(c) && p - 1 + (len = mbclen(c)) <= pend) {
rb_str_buf_cat(result, p - 1, len);
p += len - 1;
}