1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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
This commit is contained in:
nobu 2009-10-07 07:06:32 +00:00
parent be9766c37e
commit d167cfd196
3 changed files with 9 additions and 2 deletions

View file

@ -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.

View file

@ -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;}

View file

@ -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