summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-21 08:45:34 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2000-07-21 08:45:34 +0000
commitc9accd03e721f1455ccdf3f09f5251d6b93c1b4b (patch)
treee7e9ebbc425d88a42d68c78ac20d10c858318f5c
parent303974887a95ca34448821e16eec339b30d25da6 (diff)
matz
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@843 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog14
-rw-r--r--hash.c1
-rw-r--r--marshal.c12
-rw-r--r--parse.y4
-rw-r--r--process.c3
-rw-r--r--version.h4
6 files changed, 34 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index d1fb0f7..85c3027 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Fri Jul 21 17:35:01 2000 Yukihiro Matsumoto <matz@netlab.co.jp>
+
+ * 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 <matz@netlab.co.jp>
* bignum.c (bigdivrem): should use rb_int2big(), not rb_uint2big().
diff --git a/hash.c b/hash.c
index 630fb4c..a7b98e1 100644
--- a/hash.c
+++ b/hash.c
@@ -19,6 +19,7 @@
#ifndef HAVE_STRING_H
char *strchr _((char*,char));
+char *strdup _((const char*));
#endif
#define HASH_DELETED FL_USER1
diff --git a/marshal.c b/marshal.c
index af4a9fa..f4342c0 100644
--- a/marshal.c
+++ b/marshal.c
@@ -55,6 +55,7 @@ struct dump_arg {
VALUE str;
st_table *symbol;
st_table *data;
+ int taint;
};
struct dump_call_arg {
@@ -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;
@@ -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;
}
@@ -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;
@@ -494,6 +501,7 @@ struct load_arg {
st_table *symbol;
VALUE data;
VALUE proc;
+ int taint;
};
static VALUE r_object _((struct load_arg *arg));
@@ -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;
}
@@ -944,6 +952,7 @@ 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;
@@ -951,6 +960,7 @@ marshal_load(argc, argv)
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");
diff --git a/parse.y b/parse.y
index edc745b..fcdee13 100644
--- a/parse.y
+++ b/parse.y
@@ -849,6 +849,10 @@ arg : lhs '=' arg
}
aref_args : none
+ | command_call opt_nl
+ {
+ $$ = NEW_LIST($1);
+ }
| args opt_nl
{
$$ = $1;
diff --git a/process.c b/process.c
index 9a19d01..1fd43e3 100644
--- a/process.c
+++ b/process.c
@@ -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();
diff --git a/version.h b/version.h
index db3dc73..196e0d6 100644
--- a/version.h
+++ b/version.h
@@ -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