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 + + * 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 * 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; }