From 7d52ad9e177b32008aba54ae067749d246113e6b Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 13 May 2017 12:31:01 +0000 Subject: string.c: fix one-off bug * string.c (rb_str_cat_conv_enc_opts): fix one-off bug. `ofs` equals `olen` when appending at the end. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58702 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index bbbf2f506a..1d30a153cb 100644 --- a/string.c +++ b/string.c @@ -917,7 +917,7 @@ rb_str_cat_conv_enc_opts(VALUE newstr, long ofs, const char *ptr, long len, long olen; olen = RSTRING_LEN(newstr); - if (ofs < -olen || olen <= ofs) + if (ofs < -olen || olen < ofs) rb_raise(rb_eIndexError, "index %ld out of string", ofs); if (ofs < 0) ofs += olen; if (!from) { -- cgit v1.2.3