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

ruby-changes:25718

From: marcandre <ko1@a...>
Date: Wed, 21 Nov 2012 13:24:05 +0900 (JST)
Subject: [ruby-changes:25718] marcandRe: r37775 (trunk): * range.c (rb_range_beg_len): Fix potential bug for limit case [#6203]

marcandre	2012-11-21 13:23:56 +0900 (Wed, 21 Nov 2012)

  New Revision: 37775

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=37775

  Log:
    * range.c (rb_range_beg_len): Fix potential bug for limit case [#6203]

  Modified files:
    trunk/range.c

Index: range.c
===================================================================
--- range.c	(revision 37774)
+++ range.c	(revision 37775)
@@ -1076,16 +1076,16 @@
 	if (beg < 0)
 	    goto out_of_range;
     }
+    if (end < 0)
+	end += len;
+    if (!excl)
+	end++;			/* include end point */
     if (err == 0 || err == 2) {
 	if (beg > len)
 	    goto out_of_range;
 	if (end > len)
 	    end = len;
     }
-    if (end < 0)
-	end += len;
-    if (!excl)
-	end++;			/* include end point */
     len = end - beg;
     if (len < 0)
 	len = 0;

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

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