eval.c fix
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1818 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
cf4451e8c2
commit
a3d0d99530
45
eval.c
45
eval.c
@ -600,8 +600,10 @@ struct RVarmap *ruby_dyna_vars;
|
|||||||
ruby_dyna_vars = 0;
|
ruby_dyna_vars = 0;
|
||||||
|
|
||||||
#define POP_VARS() \
|
#define POP_VARS() \
|
||||||
if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) \
|
if (_old && (ruby_scope->flags & SCOPE_DONT_RECYCLE)) {\
|
||||||
|
if (RBASIC(_old)->flags) /* unless it's already recycled */ \
|
||||||
FL_SET(_old, DVAR_DONT_RECYCLE); \
|
FL_SET(_old, DVAR_DONT_RECYCLE); \
|
||||||
|
}\
|
||||||
ruby_dyna_vars = _old; \
|
ruby_dyna_vars = _old; \
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1349,8 +1351,10 @@ rb_eval_cmd(cmd, arg)
|
|||||||
volatile int safe = ruby_safe_level;
|
volatile int safe = ruby_safe_level;
|
||||||
|
|
||||||
if (TYPE(cmd) != T_STRING) {
|
if (TYPE(cmd) != T_STRING) {
|
||||||
return rb_funcall2(cmd, rb_intern("call"),
|
PUSH_ITER(ITER_NOT);
|
||||||
RARRAY(arg)->len, RARRAY(arg)->ptr);
|
val = rb_funcall2(cmd, rb_intern("call"), RARRAY(arg)->len, RARRAY(arg)->ptr);
|
||||||
|
POP_ITER();
|
||||||
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
saved_scope = ruby_scope;
|
saved_scope = ruby_scope;
|
||||||
@ -2736,7 +2740,7 @@ rb_eval(self, n)
|
|||||||
val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
|
val = rb_funcall(val, node->nd_mid, 1, rb_eval(self, rval));
|
||||||
}
|
}
|
||||||
argv[argc-1] = val;
|
argv[argc-1] = val;
|
||||||
val = rb_funcall2(recv, aset, argc, argv);
|
rb_funcall2(recv, aset, argc, argv);
|
||||||
result = val;
|
result = val;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -3921,7 +3925,7 @@ assign(self, lhs, val, pcall)
|
|||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
rb_iterate(it_proc, data1, bl_proc, data2)
|
rb_iterate(it_proc, data1, bl_proc, data2)
|
||||||
VALUE (*it_proc)(), (*bl_proc)();
|
VALUE (*it_proc) _((VALUE)), (*bl_proc)(ANYARGS);
|
||||||
VALUE data1, data2;
|
VALUE data1, data2;
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
@ -3995,10 +3999,10 @@ handle_rescue(self, node)
|
|||||||
|
|
||||||
VALUE
|
VALUE
|
||||||
#ifdef HAVE_STDARG_PROTOTYPES
|
#ifdef HAVE_STDARG_PROTOTYPES
|
||||||
rb_rescue2(VALUE (*b_proc)(), VALUE data1, VALUE (*r_proc)(), VALUE data2, ...)
|
rb_rescue2(VALUE (*b_proc)(ANYARGS), VALUE data1, VALUE (*r_proc)(ANYARGS), VALUE data2, ...)
|
||||||
#else
|
#else
|
||||||
rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
|
rb_rescue2(b_proc, data1, r_proc, data2, va_alist)
|
||||||
VALUE (*b_proc)(), (*r_proc)();
|
VALUE (*b_proc)(ANYARGS), (*r_proc)(ANYARGS);
|
||||||
VALUE data1, data2;
|
VALUE data1, data2;
|
||||||
va_dcl
|
va_dcl
|
||||||
#endif
|
#endif
|
||||||
@ -4089,8 +4093,9 @@ rb_protect(proc, data, state)
|
|||||||
VALUE
|
VALUE
|
||||||
rb_ensure(b_proc, data1, e_proc, data2)
|
rb_ensure(b_proc, data1, e_proc, data2)
|
||||||
VALUE (*b_proc)();
|
VALUE (*b_proc)();
|
||||||
|
VALUE data1;
|
||||||
VALUE (*e_proc)();
|
VALUE (*e_proc)();
|
||||||
VALUE data1, data2;
|
VALUE data2;
|
||||||
{
|
{
|
||||||
int state;
|
int state;
|
||||||
volatile VALUE result = Qnil;
|
volatile VALUE result = Qnil;
|
||||||
@ -5049,6 +5054,9 @@ rb_f_eval(argc, argv, self)
|
|||||||
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
|
rb_scan_args(argc, argv, "13", &src, &scope, &vfile, &vline);
|
||||||
if (ruby_safe_level >= 4) {
|
if (ruby_safe_level >= 4) {
|
||||||
StringValue(src);
|
StringValue(src);
|
||||||
|
if (!NIL_P(scope) && !OBJ_TAINTED(scope)) {
|
||||||
|
rb_raise(rb_eSecurityError, "Insecure: can't modify trusted binding");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
SafeStringValue(src);
|
SafeStringValue(src);
|
||||||
@ -5090,6 +5098,7 @@ exec_under(func, under, args)
|
|||||||
PUSH_CLASS();
|
PUSH_CLASS();
|
||||||
ruby_class = under;
|
ruby_class = under;
|
||||||
PUSH_FRAME();
|
PUSH_FRAME();
|
||||||
|
ruby_frame->self = _frame.prev->self;
|
||||||
ruby_frame->last_func = _frame.prev->last_func;
|
ruby_frame->last_func = _frame.prev->last_func;
|
||||||
ruby_frame->last_class = _frame.prev->last_class;
|
ruby_frame->last_class = _frame.prev->last_class;
|
||||||
ruby_frame->argc = _frame.prev->argc;
|
ruby_frame->argc = _frame.prev->argc;
|
||||||
@ -5185,7 +5194,7 @@ yield_under(under, self)
|
|||||||
return exec_under(yield_under_i, under, self);
|
return exec_under(yield_under_i, under, self);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE
|
static VALUE
|
||||||
specific_eval(argc, argv, klass, self)
|
specific_eval(argc, argv, klass, self)
|
||||||
int argc;
|
int argc;
|
||||||
VALUE *argv;
|
VALUE *argv;
|
||||||
@ -5959,10 +5968,10 @@ rb_f_at_exit()
|
|||||||
void
|
void
|
||||||
rb_exec_end_proc()
|
rb_exec_end_proc()
|
||||||
{
|
{
|
||||||
struct end_proc_data *link;
|
struct end_proc_data *link, *save;
|
||||||
int status;
|
int status;
|
||||||
|
|
||||||
link = end_procs;
|
save = link = end_procs;
|
||||||
while (link) {
|
while (link) {
|
||||||
rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
|
rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
|
||||||
if (status) {
|
if (status) {
|
||||||
@ -5970,6 +5979,14 @@ rb_exec_end_proc()
|
|||||||
}
|
}
|
||||||
link = link->next;
|
link = link->next;
|
||||||
}
|
}
|
||||||
|
link = end_procs;
|
||||||
|
while (link != save) {
|
||||||
|
rb_protect((VALUE(*)_((VALUE)))link->func, link->data, &status);
|
||||||
|
if (status) {
|
||||||
|
error_handle(status);
|
||||||
|
}
|
||||||
|
link = link->next;
|
||||||
|
}
|
||||||
while (ephemeral_end_procs) {
|
while (ephemeral_end_procs) {
|
||||||
link = ephemeral_end_procs;
|
link = ephemeral_end_procs;
|
||||||
ephemeral_end_procs = link->next;
|
ephemeral_end_procs = link->next;
|
||||||
@ -6937,14 +6954,14 @@ static VALUE
|
|||||||
method_proc(method)
|
method_proc(method)
|
||||||
VALUE method;
|
VALUE method;
|
||||||
{
|
{
|
||||||
return rb_iterate(mproc, 0, bmcall, method);
|
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, bmcall, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
umethod_proc(method)
|
umethod_proc(method)
|
||||||
VALUE method;
|
VALUE method;
|
||||||
{
|
{
|
||||||
return rb_iterate(mproc, 0, umcall, method);
|
return rb_iterate((VALUE(*)_((VALUE)))mproc, 0, umcall, method);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
@ -9063,7 +9080,7 @@ rb_catch(tag, proc, data)
|
|||||||
VALUE (*proc)();
|
VALUE (*proc)();
|
||||||
VALUE data;
|
VALUE data;
|
||||||
{
|
{
|
||||||
return rb_iterate(catch_i, rb_intern(tag), proc, data);
|
return rb_iterate((VALUE(*)_((VALUE)))catch_i, rb_intern(tag), proc, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
static VALUE
|
static VALUE
|
||||||
|
Loading…
x
Reference in New Issue
Block a user