[前][次][番号順一覧][スレッド一覧]

ruby-changes:46586

From: nobu <ko1@a...>
Date: Sat, 13 May 2017 21:31:09 +0900 (JST)
Subject: [ruby-changes:46586] nobu:r58702 (trunk): string.c: fix one-off bug

nobu	2017-05-13 21:31:01 +0900 (Sat, 13 May 2017)

  New Revision: 58702

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58702

  Log:
    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.

  Modified files:
    trunk/string.c
Index: string.c
===================================================================
--- string.c	(revision 58701)
+++ string.c	(revision 58702)
@@ -917,7 +917,7 @@ rb_str_cat_conv_enc_opts(VALUE newstr, l https://github.com/ruby/ruby/blob/trunk/string.c#L917
     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) {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]