summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--thread.c12
2 files changed, 10 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 5ccfd0d1a8..1ce1d52e58 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -30,11 +30,6 @@ Thu Nov 29 06:27:55 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
errinfo = th->errinfo; and errinfo = rb_errinfo(); are
the same.
-Thu Nov 29 06:24:15 2012 KOSAKI Motohiro <kosaki.motohiro@gmail.com>
-
- * thread.c (thread_start_func_2): remove unused code. security
- level is checked before rb_eSecurityError raises.
-
Thu Nov 29 05:26:32 2012 Koichi Sasada <ko1@atdot.net>
* vm_backtrace.c (backtrace_to_str_ary2): rename to backtrace_to_str_ary.
diff --git a/thread.c b/thread.c
index a56f264a6c..a75990ccfb 100644
--- a/thread.c
+++ b/thread.c
@@ -491,8 +491,16 @@ thread_start_func_2(rb_thread_t *th, VALUE *stack_start, VALUE *register_stack_s
if (state == TAG_FATAL) {
/* fatal error within this thread, need to stop whole script */
}
- else if (th->vm->thread_abort_on_exception ||
- th->abort_on_exception || RTEST(ruby_debug)) {
+ else if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
+ if (th->safe_level >= 4) {
+ th->errinfo = rb_exc_new3(rb_eSecurityError,
+ rb_sprintf("Insecure exit at level %d", th->safe_level));
+ errinfo = Qnil;
+ }
+ }
+ else if (th->safe_level < 4 &&
+ (th->vm->thread_abort_on_exception ||
+ th->abort_on_exception || RTEST(ruby_debug))) {
/* exit on main_thread */
}
else {