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

ruby-changes:6061

From: nobu <ko1@a...>
Date: Wed, 25 Jun 2008 15:29:29 +0900 (JST)
Subject: [ruby-changes:6061] Ruby:r17570 (trunk, ruby_1_8, mvm): * array.c (rb_ary_fill): not depend on unspecified behavior at integer

nobu	2008-06-25 15:28:53 +0900 (Wed, 25 Jun 2008)

  New Revision: 17570

  Modified files:
    branches/mvm/ChangeLog
    branches/mvm/array.c
    branches/ruby_1_8/ChangeLog
    branches/ruby_1_8/array.c
    trunk/ChangeLog
    trunk/array.c

  Log:
    * array.c (rb_ary_fill): not depend on unspecified behavior at integer
      overflow.  reported by Vincenzo Iozzo <snagg AT openssl.it>.


  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/array.c?r1=17570&r2=17569&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/ChangeLog?r1=17570&r2=17569&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/trunk/ChangeLog?r1=17570&r2=17569&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/ChangeLog?r1=17570&r2=17569&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/mvm/array.c?r1=17570&r2=17569&diff_format=u
  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi/branches/ruby_1_8/array.c?r1=17570&r2=17569&diff_format=u

Index: array.c
===================================================================
--- array.c	(revision 17569)
+++ array.c	(revision 17570)
@@ -2145,10 +2145,10 @@
 	break;
     }
     rb_ary_modify(ary);
-    end = beg + len;
-    if (end < 0) {
+    if (len > ARY_MAX_SIZE - beg) {
 	rb_raise(rb_eArgError, "argument too big");
     }
+    end = beg + len;
     if (RARRAY_LEN(ary) < end) {
 	if (end >= ARY_CAPA(ary)) {
 	    RESIZE_CAPA(ary, end);
Index: ChangeLog
===================================================================
--- ChangeLog	(revision 17569)
+++ ChangeLog	(revision 17570)
@@ -1,3 +1,8 @@
+Wed Jun 25 15:28:50 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (rb_ary_fill): not depend on unspecified behavior at integer
+	  overflow.  reported by Vincenzo Iozzo <snagg AT openssl.it>.
+
 Wed Jun 25 13:42:44 2008  NARUSE, Yui  <naruse@r...>
 
 	* lib/erb.rb (ERB::Compiler:Buffer#new): push magic comment first.
Index: ruby_1_8/array.c
===================================================================
--- ruby_1_8/array.c	(revision 17569)
+++ ruby_1_8/array.c	(revision 17570)
@@ -2416,10 +2416,10 @@
 	break;
     }
     rb_ary_modify(ary);
-    end = beg + len;
-    if (end < 0) {
+    if (len > ARY_MAX_SIZE - beg) {
 	rb_raise(rb_eArgError, "argument too big");
     }
+    end = beg + len;
     if (end > RARRAY(ary)->len) {
 	if (end >= RARRAY(ary)->aux.capa) {
 	    REALLOC_N(RARRAY(ary)->ptr, VALUE, end);
Index: ruby_1_8/ChangeLog
===================================================================
--- ruby_1_8/ChangeLog	(revision 17569)
+++ ruby_1_8/ChangeLog	(revision 17570)
@@ -1,3 +1,8 @@
+Wed Jun 25 15:28:50 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (rb_ary_fill): not depend on unspecified behavior at integer
+	  overflow.  reported by Vincenzo Iozzo <snagg AT openssl.it>.
+
 Wed Jun 25 00:01:27 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* common.mk (revision.h): moved from Makefile.in.
Index: mvm/array.c
===================================================================
--- mvm/array.c	(revision 17569)
+++ mvm/array.c	(revision 17570)
@@ -2145,10 +2145,10 @@
 	break;
     }
     rb_ary_modify(ary);
-    end = beg + len;
-    if (end < 0) {
+    if (len > ARY_MAX_SIZE - beg) {
 	rb_raise(rb_eArgError, "argument too big");
     }
+    end = beg + len;
     if (RARRAY_LEN(ary) < end) {
 	if (end >= ARY_CAPA(ary)) {
 	    RESIZE_CAPA(ary, end);
Index: mvm/ChangeLog
===================================================================
--- mvm/ChangeLog	(revision 17569)
+++ mvm/ChangeLog	(revision 17570)
@@ -1,3 +1,8 @@
+Wed Jun 25 15:28:50 2008  Nobuyoshi Nakada  <nobu@r...>
+
+	* array.c (rb_ary_fill): not depend on unspecified behavior at integer
+	  overflow.  reported by Vincenzo Iozzo <snagg AT openssl.it>.
+
 Tue Jun 24 17:20:39 2008  Nobuyoshi Nakada  <nobu@r...>
 
 	* configure.in (rb_cv_fork_with_pthread): check after check for

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

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