[macruby-changes] [5257] MacRuby/trunk/array.c

source_changes at macosforge.org source_changes at macosforge.org
Sun Mar 6 03:55:05 PST 2011


Revision: 5257
          http://trac.macosforge.org/projects/ruby/changeset/5257
Author:   watson1978 at gmail.com
Date:     2011-03-06 03:55:02 -0800 (Sun, 06 Mar 2011)
Log Message:
-----------
Array#fill(start, length) will raise a ArgumentError when was passed huge length.

Test Script:
{{{
require 'test/unit/assertions.rb'
include Test::Unit::Assertions

ary = [ "a", "b", "c" ]
assert_raise(ArgumentError){ ary.fill("z", 0, 2**60) }

puts :ok
}}}

Modified Paths:
--------------
    MacRuby/trunk/array.c

Modified: MacRuby/trunk/array.c
===================================================================
--- MacRuby/trunk/array.c	2011-03-06 11:08:26 UTC (rev 5256)
+++ MacRuby/trunk/array.c	2011-03-06 11:55:02 UTC (rev 5257)
@@ -2292,7 +2292,7 @@
 	return ary;
     }
     end = beg + len;
-    if (end < 0) {
+    if (beg >= ARY_MAX_SIZE || len > ARY_MAX_SIZE - beg) {
 	rb_raise(rb_eArgError, "argument too big");
     }
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20110306/981b5f14/attachment.html>


More information about the macruby-changes mailing list