* array.c (rb_ary_times): taint (and untrust) status should be

inherited by "ary * 0".  [ruby-dev:37024]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
matz 2008-11-25 14:29:39 +00:00
parent 446ea127c3
commit 405b527276
2 changed files with 10 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Tue Nov 25 16:26:12 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* array.c (rb_ary_times): taint (and untrust) status should be
inherited by "ary * 0". [ruby-dev:37024]
Tue Nov 25 15:54:07 2008 Yukihiro Matsumoto <matz@ruby-lang.org> Tue Nov 25 15:54:07 2008 Yukihiro Matsumoto <matz@ruby-lang.org>
* strftime.c (rb_strftime): should not swallow incomplete * strftime.c (rb_strftime): should not swallow incomplete

View File

@ -2551,7 +2551,10 @@ rb_ary_times(VALUE ary, VALUE times)
} }
len = NUM2LONG(times); len = NUM2LONG(times);
if (len == 0) return ary_new(rb_obj_class(ary), 0); if (len == 0) {
ary2 = ary_new(rb_obj_class(ary), 0);
goto out;
}
if (len < 0) { if (len < 0) {
rb_raise(rb_eArgError, "negative argument"); rb_raise(rb_eArgError, "negative argument");
} }
@ -2566,6 +2569,7 @@ rb_ary_times(VALUE ary, VALUE times)
for (i=0; i<len; i+=RARRAY_LEN(ary)) { for (i=0; i<len; i+=RARRAY_LEN(ary)) {
MEMCPY(RARRAY_PTR(ary2)+i, RARRAY_PTR(ary), VALUE, RARRAY_LEN(ary)); MEMCPY(RARRAY_PTR(ary2)+i, RARRAY_PTR(ary), VALUE, RARRAY_LEN(ary));
} }
out:
OBJ_INFECT(ary2, ary); OBJ_INFECT(ary2, ary);
return ary2; return ary2;