aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-07 07:06:32 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-10-07 07:06:32 +0000
commitd167cfd196c410cbab11e1c3b8cce14297e4a085 (patch)
tree11eae1ed1c5591818ad3a3a8569ba6e75587b701
parentbe9766c37e614ca0a9286613f7b0a676f0c0adaf (diff)
downloadruby-d167cfd196c410cbab11e1c3b8cce14297e4a085.tar.gz
* include/ruby/ruby.h (rb_long2int): evalates the argument only
once. * struct.c (rb_struct_alloc): check array length overflow. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@25255 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog7
-rw-r--r--include/ruby/ruby.h2
-rw-r--r--struct.c2
3 files changed, 9 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index ffc679d8a1..2887de5bcb 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed Oct 7 16:06:30 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * include/ruby/ruby.h (rb_long2int): evalates the argument only
+ once.
+
+ * struct.c (rb_struct_alloc): check array length overflow.
+
Wed Oct 7 09:23:49 2009 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_str_inspect): don't assign -1 to unsigned int.
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h
index 8fc1eb0f03..33a35ce435 100644
--- a/include/ruby/ruby.h
+++ b/include/ruby/ruby.h
@@ -653,7 +653,7 @@ NORETURN(void rb_out_of_int(SIGNED_VALUE num));
int i = (int)(n); \
if ((long)i != (n)) rb_out_of_int(n)
#ifdef __GNUC__
-#define rb_long2int(i2l_n) __extension__ ({rb_long2int_internal(i2l_n, i2l_i); i2l_i;})
+#define rb_long2int(n) __extension__ ({long i2l_n = (n); rb_long2int_internal(i2l_n, i2l_i); i2l_i;})
#else
static inline int
rb_long2int(long n) {rb_long2int_internal(n, i); return i;}
diff --git a/struct.c b/struct.c
index f3b8279213..fe3885f7a6 100644
--- a/struct.c
+++ b/struct.c
@@ -415,7 +415,7 @@ struct_alloc(VALUE klass)
VALUE
rb_struct_alloc(VALUE klass, VALUE values)
{
- return rb_class_new_instance(RARRAY_LEN(values), RARRAY_PTR(values), klass);
+ return rb_class_new_instance(RARRAY_LENINT(values), RARRAY_PTR(values), klass);
}
VALUE