summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--bignum.c18
-rw-r--r--eval.c11
-rw-r--r--lib/cgi/session.rb4
4 files changed, 24 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f2d73bbd2c..626719ae8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sat Aug 28 23:04:41 2004 Yukihiro Matsumoto <matz@ruby-lang.org>
+
+ * bignum.c (rb_big_and): protect parameters from GC.
+ [ruby-talk:110664]
+
Thu Aug 26 04:38:29 2004 Dave Thomas <dave@pragprog.com>
* eval.c (return_jump): Minor typo in error message. Now reads
diff --git a/bignum.c b/bignum.c
index 35b79d8877..d674e68298 100644
--- a/bignum.c
+++ b/bignum.c
@@ -1622,15 +1622,16 @@ rb_big_pow(x, y)
*/
VALUE
-rb_big_and(x, y)
- VALUE x, y;
+rb_big_and(xx, yy)
+ VALUE xx, yy;
{
- VALUE z;
+ volatile VALUE x, y, z;
BDIGIT *ds1, *ds2, *zds;
long i, l1, l2;
char sign;
- y = rb_to_int(y);
+ x = xx;
+ y = rb_to_int(yy);
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
@@ -1677,15 +1678,16 @@ rb_big_and(x, y)
*/
VALUE
-rb_big_or(x, y)
- VALUE x, y;
+rb_big_or(xx, yy)
+ VALUE xx, yy;
{
- VALUE z;
+ volatile VALUE x, y, z;
BDIGIT *ds1, *ds2, *zds;
long i, l1, l2;
char sign;
- y = rb_to_int(y);
+ x = xx;
+ y = rb_to_int(yy);
if (FIXNUM_P(y)) {
y = rb_int2big(FIX2LONG(y));
}
diff --git a/eval.c b/eval.c
index fa01bcdca3..d77ecd5858 100644
--- a/eval.c
+++ b/eval.c
@@ -3785,6 +3785,9 @@ rb_eval(self, n)
ID cname;
int gen = Qfalse;
+ cbase = class_prefix(self, node->nd_cpath);
+ cname = node->nd_cpath->nd_mid;
+
if (NIL_P(ruby_cbase)) {
rb_raise(rb_eTypeError, "no outer class/module");
}
@@ -3795,8 +3798,6 @@ rb_eval(self, n)
super = 0;
}
- cbase = class_prefix(self, node->nd_cpath);
- cname = node->nd_cpath->nd_mid;
if (rb_const_defined_at(cbase, cname)) {
klass = rb_const_get_at(cbase, cname);
if (TYPE(klass) != T_CLASS) {
@@ -4909,7 +4910,7 @@ massign(self, node, val, pcall)
}
if (pcall && list) goto arg_error;
if (node->nd_args) {
- if ((int)(node->nd_args) == -1) {
+ if ((long)(node->nd_args) == -1) {
/* no check for mere `*' */
}
else if (!list && i<len) {
@@ -5610,7 +5611,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)",
argc, i);
}
- if ((int)node->nd_rest == -1) {
+ if ((long)node->nd_rest == -1) {
int opt = i;
NODE *optnode = node->nd_opt;
@@ -5645,7 +5646,7 @@ rb_call0(klass, recv, id, oid, argc, argv, body, nosuper)
}
}
local_vars = ruby_scope->local_vars;
- if ((int)node->nd_rest >= 0) {
+ if ((long)node->nd_rest >= 0) {
VALUE v;
if (argc > 0)
diff --git a/lib/cgi/session.rb b/lib/cgi/session.rb
index c320ac9c47..9a49fdedc9 100644
--- a/lib/cgi/session.rb
+++ b/lib/cgi/session.rb
@@ -173,7 +173,9 @@ class CGI
def Session::create_new_id
require 'digest/md5'
md5 = Digest::MD5::new
- md5.update(String(Time::now))
+ now = Time::now
+ md5.update(now.to_s)
+ md5.update(String(now.usec))
md5.update(String(rand(0)))
md5.update(String($$))
md5.update('foobar')