Project

General

Profile

Backport #4339 » ruby-1.8.7-trac22417.patch

Patch file - rhythmx (Sean Bradly), 02/01/2011 08:56 AM

View differences:

ruby-1.8.7-bps-p1/marshal.c 2011-01-31 16:55:34.096667660 -0600
if (arg->taint) {
OBJ_TAINT(arg->str);
}
return 0;
}
......
{
VALUE obj, port, a1, a2;
int limit = -1;
struct dump_arg arg;
struct dump_arg *arg = malloc(sizeof(struct dump_arg));
struct dump_call_arg c_arg;
if(!arg)
rb_memerror();
port = Qnil;
rb_scan_args(argc, argv, "12", &obj, &a1, &a2);
if (argc == 3) {
......
else if (NIL_P(a1)) goto type_error;
else port = a1;
}
arg.dest = 0;
arg.symbols = st_init_numtable();
arg.data = st_init_numtable();
arg.taint = Qfalse;
arg.str = rb_str_buf_new(0);
RBASIC(arg.str)->klass = 0;
arg.wrapper = Data_Wrap_Struct(rb_cData, mark_dump_arg, 0, &arg);
arg->dest = 0;
arg->symbols = st_init_numtable();
arg->data = st_init_numtable();
arg->taint = Qfalse;
arg->str = rb_str_buf_new(0);
RBASIC(arg->str)->klass = 0;
arg->wrapper = Data_Wrap_Struct(rb_cData, mark_dump_arg, 0, arg);
if (!NIL_P(port)) {
if (!rb_respond_to(port, s_write)) {
type_error:
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.dest = port;
arg->dest = port;
if (rb_respond_to(port, s_binmode)) {
rb_funcall2(port, s_binmode, 0, 0);
check_dump_arg(&arg, s_binmode);
check_dump_arg(arg, s_binmode);
}
}
else {
port = arg.str;
port = arg->str;
}
c_arg.obj = obj;
c_arg.arg = &arg;
c_arg.arg = arg;
c_arg.limit = limit;
w_byte(MARSHAL_MAJOR, &arg);
w_byte(MARSHAL_MINOR, &arg);
rb_ensure(dump, (VALUE)&c_arg, dump_ensure, (VALUE)&arg);
RBASIC(arg.str)->klass = rb_cString;
w_byte(MARSHAL_MAJOR, arg);
w_byte(MARSHAL_MINOR, arg);
rb_ensure(dump, (VALUE)&c_arg, dump_ensure, (VALUE)arg);
RBASIC(arg->str)->klass = rb_cString;
free(arg);
return port;
}
......
VALUE port, proc;
int major, minor, taint = Qfalse;
VALUE v;
struct load_arg arg;
struct load_arg *arg = malloc(sizeof(struct load_arg));
if(!arg)
rb_memerror();
rb_scan_args(argc, argv, "11", &port, &proc);
v = rb_check_string_type(port);
......
else {
rb_raise(rb_eTypeError, "instance of IO needed");
}
arg.src = port;
arg.offset = 0;
arg.symbols = st_init_numtable();
arg.data = st_init_numtable();
arg.proc = 0;
arg.wrapper = Data_Wrap_Struct(rb_cData, mark_load_arg, 0, &arg);
arg.taint = taint;
arg->src = port;
arg->offset = 0;
arg->symbols = st_init_numtable();
arg->data = st_init_numtable();
arg->proc = 0;
arg->wrapper = Data_Wrap_Struct(rb_cData, mark_load_arg, 0, arg);
arg->taint = taint;
major = r_byte(&arg);
minor = r_byte(&arg);
major = r_byte(arg);
minor = r_byte(arg);
if (major != MARSHAL_MAJOR || minor > MARSHAL_MINOR) {
rb_raise(rb_eTypeError, "incompatible marshal file format (can't be read)\n\
\tformat version %d.%d required; %d.%d given",
......
MARSHAL_MAJOR, MARSHAL_MINOR, major, minor);
}
if (!NIL_P(proc)) arg.proc = proc;
v = rb_ensure(load, (VALUE)&arg, load_ensure, (VALUE)&arg);
if (!NIL_P(proc)) arg->proc = proc;
v = rb_ensure(load, (VALUE)arg, load_ensure, (VALUE)arg);
free(arg);
return v;
}
(2-2/3)