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

* proc.c (rb_proc_call): checks overflow.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22954 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2009-03-14 09:05:09 +00:00
parent eb89ad23cb
commit 886214bc01
2 changed files with 11 additions and 2 deletions

View file

@ -1,4 +1,6 @@
Sat Mar 14 17:59:10 2009 Nobuyoshi Nakada <nobu@ruby-lang.org> Sat Mar 14 18:05:08 2009 Nobuyoshi Nakada <nobu@ruby-lang.org>
* proc.c (rb_proc_call): checks overflow.
* proc.c (rb_proc_parameters): unnamed_parameters() expects in * proc.c (rb_proc_parameters): unnamed_parameters() expects in
not VALUE. not VALUE.

9
proc.c
View file

@ -529,10 +529,17 @@ proc_call(int argc, VALUE *argv, VALUE procval)
VALUE VALUE
rb_proc_call(VALUE self, VALUE args) rb_proc_call(VALUE self, VALUE args)
{ {
long argc = RARRAY_LEN(args);
rb_proc_t *proc; rb_proc_t *proc;
GetProcPtr(self, proc); GetProcPtr(self, proc);
#if SIZEOF_LONG > SIZEOF_INT
if (argc > INT_MAX || argc < 0) {
rb_raise(rb_eArgError, "too many arguments (%lu)",
(unsigned long)argc);
}
#endif
return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self, return rb_vm_invoke_proc(GET_THREAD(), proc, proc->block.self,
RARRAY_LEN(args), RARRAY_PTR(args), 0); (int)argc, RARRAY_PTR(args), 0);
} }
VALUE VALUE