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

ruby-changes:4504

From: ko1@a...
Date: Mon, 14 Apr 2008 12:58:51 +0900 (JST)
Subject: [ruby-changes:4504] matz - Ruby:r15997 (trunk): * array.c (ary_new): new integer overflow check condition.

matz	2008-04-14 12:58:35 +0900 (Mon, 14 Apr 2008)

  New Revision: 15997

  Modified files:
    trunk/ChangeLog
    trunk/array.c

  Log:
    * array.c (ary_new): new integer overflow check condition.
      suggested by TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in
      [ruby-dev:34156].
    
    * array.c (rb_ary_initialize): ditto.

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?r1=15997&r2=15996&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=15997&r2=15996&diff_format=u

Index: array.c
===================================================================
--- array.c	(revision 15996)
+++ array.c	(revision 15997)
@@ -114,7 +114,7 @@
     if (len < 0) {
 	rb_raise(rb_eArgError, "negative array size (or size too big)");
     }
-    if (len > 0 && len * (long)sizeof(VALUE) <= len) {
+    if (len > LONG_MAX / sizeof(VALUE)) {
 	rb_raise(rb_eArgError, "array size too big");
     }
     ary = ary_alloc(klass);
@@ -313,7 +313,7 @@
     if (len < 0) {
 	rb_raise(rb_eArgError, "negative array size");
     }
-    if (len > 0 && len * (long)sizeof(VALUE) <= len) {
+    if (len > LONG_MAX / sizeof(VALUE)) {
 	rb_raise(rb_eArgError, "array size too big");
     }
     rb_ary_modify(ary);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 15996)
+++ ChangeLog	(revision 15997)
@@ -6,6 +6,14 @@
 
 	* gc.c (finalizers): removed.  [ruby-dev:34349]
 
+Mon Apr 14 11:30:07 2008  Yukihiro Matsumoto  <matz@r...>
+
+	* array.c (ary_new): new integer overflow check condition.
+	  suggested by TOYOFUKU Chikanobu <nobu_toyofuku at nifty.com> in
+	  [ruby-dev:34156].
+
+	* array.c (rb_ary_initialize): ditto.
+
 Mon Apr 14 00:51:40 2008  Yusuke Endoh  <mame@t...>
 
 	* test/ruby/test_parse.rb: add tests to achieve over 95% test coverage

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

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