Skip to content

Commit

Permalink
matz
Browse files Browse the repository at this point in the history
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Jul 21, 2000
1 parent 3039748 commit c9accd0
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 4 deletions.
14 changes: 14 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto <[email protected]>

* parse.y (aref_args): command_call now be permitted as
aref_args.

* process.c (proc_getpriority): getpriority(2) may return valid
negative number. use errno to detect error.

* marshal.c (dump_ensure): dumped string should be tainted if
any among target objects is tainted.

* marshal.c (r_regist): restored object should be tainted if and
only if the source is a file or a tainted string.

Wed Jul 19 15:14:04 2000 Yukihiro Matsumoto <[email protected]>

* bignum.c (bigdivrem): should use rb_int2big(), not rb_uint2big().
Expand Down
1 change: 1 addition & 0 deletions hash.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

#ifndef HAVE_STRING_H
char *strchr _((char*,char));
char *strdup _((const char*));
#endif

#define HASH_DELETED FL_USER1
Expand Down
12 changes: 11 additions & 1 deletion marshal.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ struct dump_arg {
VALUE str;
st_table *symbol;
st_table *data;
int taint;
};

struct dump_call_arg {
Expand Down Expand Up @@ -270,6 +271,8 @@ w_object(obj, arg, limit)
return;
}

if (OBJ_TAINTED(obj)) arg->taint = Qtrue;

st_add_direct(arg->data, obj, arg->data->num_entries);
if (rb_respond_to(obj, s_dump)) {
VALUE v;
Expand Down Expand Up @@ -432,6 +435,9 @@ dump_ensure(arg)
{
st_free_table(arg->symbol);
st_free_table(arg->data);
if (!arg->fp && arg->taint) {
OBJ_TAINT(arg->str);
}
return 0;
}

Expand Down Expand Up @@ -476,6 +482,7 @@ marshal_dump(argc, argv)

arg.symbol = st_init_numtable();
arg.data = st_init_numtable();
arg.taint = Qfalse;
c_arg.obj = obj;
c_arg.arg = &arg;
c_arg.limit = limit;
Expand All @@ -494,6 +501,7 @@ struct load_arg {
st_table *symbol;
VALUE data;
VALUE proc;
int taint;
};

static VALUE r_object _((struct load_arg *arg));
Expand Down Expand Up @@ -658,11 +666,11 @@ r_regist(v, arg)
VALUE v;
struct load_arg *arg;
{
OBJ_TAINT(v);
if (arg->proc) {
rb_funcall(arg->proc, rb_intern("call"), 1, v);
}
rb_hash_aset(arg->data, INT2FIX(RHASH(arg->data)->tbl->num_entries), v);
if (arg->taint) OBJ_TAINT(v);
return v;
}

Expand Down Expand Up @@ -944,13 +952,15 @@ marshal_load(argc, argv)
GetOpenFile(port, fptr);
rb_io_check_readable(fptr);
arg.fp = fptr->f;
arg.taint = Qtrue;
}
else if (rb_respond_to(port, rb_intern("to_str"))) {
int len;

arg.fp = 0;
arg.ptr = rb_str2cstr(port, &len);
arg.end = arg.ptr + len;
arg.taint = OBJ_TAINTED(port);
}
else {
rb_raise(rb_eTypeError, "instance of IO needed");
Expand Down
4 changes: 4 additions & 0 deletions parse.y
Original file line number Diff line number Diff line change
Expand Up @@ -849,6 +849,10 @@ arg : lhs '=' arg
}

aref_args : none
| command_call opt_nl
{
$$ = NEW_LIST($1);
}
| args opt_nl
{
$$ = $1;
Expand Down
3 changes: 2 additions & 1 deletion process.c
Original file line number Diff line number Diff line change
Expand Up @@ -891,8 +891,9 @@ proc_getpriority(obj, which, who)
iwhich = NUM2INT(which);
iwho = NUM2INT(who);

errno = 0;
prio = getpriority(iwhich, iwho);
if (prio < 0) rb_sys_fail(0);
if (errno) rb_sys_fail(0);
return INT2FIX(prio);
#else
rb_notimplement();
Expand Down
4 changes: 2 additions & 2 deletions version.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#define RUBY_VERSION "1.5.4"
#define RUBY_RELEASE_DATE "2000-07-19"
#define RUBY_RELEASE_DATE "2000-07-21"
#define RUBY_VERSION_CODE 154
#define RUBY_RELEASE_CODE 20000719
#define RUBY_RELEASE_CODE 20000721

0 comments on commit c9accd0

Please sign in to comment.