Skip to content

Commit

Permalink
* signal.c (sighandle): should not re-register sighandler if
Browse files Browse the repository at this point in the history
  POSIX_SIGNAL is defined.

* eval.c (error_print): errat array may be empty.

* eval.c (rb_eval_cmd): should not upgrade safe level unless
  explicitly specified by argument newly added.

* signal.c (sig_trap): should not allow tainted trap closure.

* variable.c (rb_f_trace_var): should not allow trace_var on safe
  level higher than 3.

* variable.c (rb_f_trace_var): should not allow tainted trace
  closure.

* gc.c: do not use static stack until system stack overflows.

* eval.c (eval): should call Exception#exception instead of
  calling rb_exc_new3() directly.

* error.c (exc_exception): set "mesg" directly to the clone.  it
  might be better to set mesg via some method for flexibility.

* variable.c (cvar_override_check): should print original module
  name, if 'a' is T_ICLASS.

* parse.y (yylex): float '1_.0' should not be allowed.

* variable.c (var_getter): should care about var as Qfalse
  (ruby-bugs#PR199).

* array.c (cmpint): <=> or block for {min,max} may return bignum.

* array.c (sort_1): use rb_compint.

* array.c (sort_2): ditto.

* enum.c (min_ii): ditto.

* enum.c (min_ii): ditto.

* enum.c (max_i): ditto.

* enum.c (max_ii): ditto.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1827 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
matz committed Nov 13, 2001
1 parent 948ff24 commit 7422ccd
Show file tree
Hide file tree
Showing 14 changed files with 327 additions and 269 deletions.
60 changes: 60 additions & 0 deletions ChangeLog
Expand Up @@ -5,6 +5,11 @@ Tue Nov 13 16:49:16 2001 Usaku Nakamura <usa@ruby-lang.org>

* win32/win32.c (do_spawn): ditto.

Tue Nov 13 14:39:11 2001 WATANABE Tetsuya <tetsu@jpn.hp.com>

* signal.c (sighandle): should not re-register sighandler if
POSIX_SIGNAL is defined.

Tue Nov 13 12:55:59 2001 Usaku Nakamura <usa@ruby-lang.org>

* win32/win32.c (do_spawn): use CreateChild() instead of calling
Expand Down Expand Up @@ -70,6 +75,45 @@ Tue Nov 13 12:38:12 2001 Usaku Nakamura <usa@ruby-lang.org>
* win32/win32.c, win32/win32.h (win32_free_environ): free environment
variables list. [new]

Mon Nov 12 16:48:48 2001 Yukihiro Matsumoto <matz@ruby-lang.org>

* eval.c (error_print): errat array may be empty.

Mon Nov 12 01:30:37 2001 Yukihiro Matsumoto <matz@ruby-lang.org>

* eval.c (rb_eval_cmd): should not upgrade safe level unless
explicitly specified by argument newly added.

* signal.c (sig_trap): should not allow tainted trap closure.

* variable.c (rb_f_trace_var): should not allow trace_var on safe
level higher than 3.

* variable.c (rb_f_trace_var): should not allow tainted trace
closure.

Sun Nov 11 00:12:23 2001 TAMURA Takashi <sheepman@tcn.zaq.ne.jp>

* gc.c: do not use static stack until system stack overflows.

Sat Nov 10 03:57:09 2001 Yukihiro Matsumoto <matz@ruby-lang.org>

* eval.c (eval): should call Exception#exception instead of
calling rb_exc_new3() directly.

* error.c (exc_exception): set "mesg" directly to the clone. it
might be better to set mesg via some method for flexibility.

Sat Nov 10 00:14:24 2001 Yukihiro Matsumoto <matz@ruby-lang.org>

* variable.c (cvar_override_check): should print original module
name, if 'a' is T_ICLASS.

* parse.y (yylex): float '1_.0' should not be allowed.

* variable.c (var_getter): should care about var as Qfalse
(ruby-bugs#PR199).

Fri Nov 9 13:50:06 2001 Usaku Nakamura <usa@ruby-lang.org>

* win32/config.status.in: make CFLAGS same as Makefile's one.
Expand All @@ -82,6 +126,22 @@ Thu Nov 8 20:20:37 2001 Nobuyoshi Nakada <nobu.nakada@nifty.ne.jp>
* eval.c (rb_call0): adjust caller source file/line while
evaluating optional arguments.

Thu Nov 8 18:41:58 2001 Yukihiro Matsumoto <matz@ruby-lang.org>

* array.c (cmpint): <=> or block for {min,max} may return bignum.

* array.c (sort_1): use rb_compint.

* array.c (sort_2): ditto.

* enum.c (min_ii): ditto.

* enum.c (min_ii): ditto.

* enum.c (max_i): ditto.

* enum.c (max_ii): ditto.

Thu Nov 8 18:21:02 2001 Yukihiro Matsumoto <matz@ruby-lang.org>

* file.c (path_check_1): forgot to initialize 'p'.
Expand Down
18 changes: 16 additions & 2 deletions array.c
Expand Up @@ -1004,12 +1004,26 @@ rb_ary_reverse_m(ary)
return rb_ary_reverse(rb_ary_dup(ary));
}

int
rb_cmpint(cmp)
VALUE cmp;
{
if (FIXNUM_P(cmp)) return NUM2LONG(cmp);
if (TYPE(cmp) == T_BIGNUM) {
if (RBIGNUM(cmp)->sign) return 1;
return -1;
}
if (rb_funcall(cmp, '>', 1, INT2FIX(0))) return 1;
if (rb_funcall(cmp, '<', 1, INT2FIX(0))) return -1;
return 0;
}

static int
sort_1(a, b)
VALUE *a, *b;
{
VALUE retval = rb_yield(rb_assoc_new(*a, *b));
return NUM2INT(retval);
return rb_cmpint(retval);
}

static int
Expand All @@ -1026,7 +1040,7 @@ sort_2(a, b)
}

retval = rb_funcall(*a, cmp, 1, *b);
return NUM2INT(retval);
return rb_cmpint(retval);
}

static VALUE
Expand Down
4 changes: 3 additions & 1 deletion configure.in
Expand Up @@ -17,7 +17,9 @@ AC_ARG_WITH(gcc, [--without-gcc never use gcc], [
without_gcc=no;;
*) CC=$withval
without_gcc=$withval;;
esac], [without_gcc=no])
esac], [
CC=gcc
without_gcc=no])
dnl If the user switches compilers, we can't believe the cache
if test ! -z "$ac_cv_prog_CC" -a ! -z "$CC" -a "$CC" != "$ac_cv_prog_CC"
then
Expand Down
10 changes: 5 additions & 5 deletions enum.c
Expand Up @@ -89,7 +89,7 @@ enum_find(argc, argv, obj)
}
rb_gc_force_recycle((VALUE)memo);
if (!NIL_P(if_none)) {
rb_eval_cmd(if_none, rb_ary_new2(0));
rb_eval_cmd(if_none, rb_ary_new2(0), 0);
}
return Qnil;
}
Expand Down Expand Up @@ -299,7 +299,7 @@ min_i(i, memo)
memo->u1.value = i;
else {
cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
if (NUM2LONG(cmp) < 0)
if (rb_cmpint(cmp) < 0)
memo->u1.value = i;
}
return Qnil;
Expand All @@ -316,7 +316,7 @@ min_ii(i, memo)
memo->u1.value = i;
else {
cmp = rb_yield(rb_assoc_new(i, memo->u1.value));
if (NUM2LONG(cmp) < 0)
if (rb_cmpint(cmp) < 0)
memo->u1.value = i;
}
return Qnil;
Expand Down Expand Up @@ -344,7 +344,7 @@ max_i(i, memo)
memo->u1.value = i;
else {
cmp = rb_funcall(i, id_cmp, 1, memo->u1.value);
if (NUM2LONG(cmp) > 0)
if (rb_cmpint(cmp) > 0)
memo->u1.value = i;
}
return Qnil;
Expand All @@ -361,7 +361,7 @@ max_ii(i, memo)
memo->u1.value = i;
else {
cmp = rb_yield(rb_assoc_new(i, memo->u1.value));
if (NUM2LONG(cmp) > 0)
if (rb_cmpint(cmp) > 0)
memo->u1.value = i;
}
return Qnil;
Expand Down
2 changes: 1 addition & 1 deletion error.c
Expand Up @@ -324,7 +324,7 @@ exc_exception(argc, argv, self)
if (argc == 0) return self;
if (argc == 1 && self == argv[0]) return self;
exc = rb_obj_clone(self);
rb_obj_call_init(exc, argc, argv);
exc_initialize(argc, argv, exc);

return exc;
}
Expand Down
18 changes: 11 additions & 7 deletions eval.c
Expand Up @@ -924,12 +924,15 @@ error_print()
errat = Qnil;
}
POP_TAG();
if (NIL_P(errat)) {
if (NIL_P(errat)){
if (ruby_sourcefile)
fprintf(stderr, "%s:%d", ruby_sourcefile, ruby_sourceline);
else
fprintf(stderr, "%d", ruby_sourceline);
}
else if (RARRAY(errat)->len == 0) {
error_pos();
}
else {
VALUE mesg = RARRAY(errat)->ptr[0];

Expand Down Expand Up @@ -1342,8 +1345,9 @@ jump_tag_but_local_jump(state)
}

VALUE
rb_eval_cmd(cmd, arg)
rb_eval_cmd(cmd, arg, tcheck)
VALUE cmd, arg;
int tcheck;
{
int state;
VALUE val; /* OK */
Expand All @@ -1365,7 +1369,7 @@ rb_eval_cmd(cmd, arg)
ruby_frame->self = ruby_top_self;
ruby_frame->cbase = (VALUE)rb_node_newnode(NODE_CREF,ruby_wrapper,0,0);

if (OBJ_TAINTED(cmd)) {
if (tcheck && OBJ_TAINTED(cmd)) {
ruby_safe_level = 4;
}

Expand Down Expand Up @@ -1396,7 +1400,7 @@ rb_trap_eval(cmd, sig)
PUSH_TAG(PROT_NONE);
PUSH_ITER(ITER_NOT);
if ((state = EXEC_TAG()) == 0) {
val = rb_eval_cmd(cmd, rb_ary_new3(1, INT2FIX(sig)));
val = rb_eval_cmd(cmd, rb_ary_new3(1, INT2FIX(sig)), 0);
}
POP_ITER();
POP_TAG();
Expand Down Expand Up @@ -1430,7 +1434,7 @@ superclass(self, node)
rb_raise(rb_eTypeError, "undefined superclass `%s'",
rb_id2name(node->nd_vid));
default:
rb_raise(rb_eTypeError, "superclass undefined");
break;
}
JUMP_TAG(state);
}
Expand Down Expand Up @@ -4257,7 +4261,7 @@ static unsigned int STACK_LEVEL_MAX = 65535;
#ifdef __human68k__
extern unsigned int _stacksize;
# define STACK_LEVEL_MAX (_stacksize - 4096)
#undef HAVE_GETRLIMIT
# undef HAVE_GETRLIMIT
#else
#ifdef HAVE_GETRLIMIT
static unsigned int STACK_LEVEL_MAX = 655300;
Expand Down Expand Up @@ -5037,7 +5041,7 @@ eval(self, src, scope, file, line)
err = rb_str_dup(ruby_errinfo);
}
errat = Qnil;
rb_exc_raise(rb_exc_new3(CLASS_OF(ruby_errinfo), err));
rb_exc_raise(rb_funcall(ruby_errinfo, rb_intern("exception"), 1, err));
}
rb_exc_raise(ruby_errinfo);
}
Expand Down
3 changes: 1 addition & 2 deletions file.c
Expand Up @@ -2325,8 +2325,7 @@ rb_find_file_ext(filep, ext)
int i, j;

if (f[0] == '~') {
fname = *filep;
fname = rb_file_s_expand_path(1, &fname);
fname = rb_file_s_expand_path(1, filep);
if (rb_safe_level() >= 2 && OBJ_TAINTED(fname)) {
rb_raise(rb_eSecurityError, "loading from unsafe file %s", f);
}
Expand Down

0 comments on commit 7422ccd

Please sign in to comment.