1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

eval.c: no overwrite SystemStackError backtrace

* eval.c (setup_exception): should not overwrite SystemStackError
  backtrace if set already.  [ruby-core:63377] [Feature ]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@46594 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2014-06-28 04:58:53 +00:00
parent 3ff85b795a
commit fd4df3be5c
3 changed files with 16 additions and 7 deletions

View file

@ -1,4 +1,7 @@
Sat Jun 28 13:58:19 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
Sat Jun 28 13:58:48 2014 Nobuyoshi Nakada <nobu@ruby-lang.org>
* eval.c (setup_exception): should not overwrite SystemStackError
backtrace if set already. [ruby-core:63377] [Feature #6216]
* eval.c (setup_exception): get rid of method calls before raising
stack overflow, not to cause stack overflow again.

14
eval.c
View file

@ -493,13 +493,15 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
if (file && !NIL_P(mesg)) {
VALUE at;
if (sysstack_error_p(mesg)) {
at = rb_vm_backtrace_object();
if (mesg == sysstack_error) {
VALUE ruby_vm_sysstack_error_copy(void);
mesg = ruby_vm_sysstack_error_copy();
if (NIL_P(rb_attr_get(mesg, idBt))) {
at = rb_vm_backtrace_object();
if (mesg == sysstack_error) {
VALUE ruby_vm_sysstack_error_copy(void);
mesg = ruby_vm_sysstack_error_copy();
}
rb_ivar_set(mesg, idBt, at);
rb_ivar_set(mesg, idBt_locations, at);
}
rb_ivar_set(mesg, idBt, at);
rb_ivar_set(mesg, idBt_locations, at);
}
else if (NIL_P(get_backtrace(mesg))) {
at = rb_vm_backtrace_object();

View file

@ -533,6 +533,10 @@ end.join
e = assert_raise(SystemStackError, feature6216) {m}
level = e.backtrace.size
assert_operator(level, :>, 10, feature6216)
feature6216 = '[ruby-core:63377] [Feature #6216]'
e = assert_raise(SystemStackError, feature6216) {raise e}
assert_equal(level, e.backtrace.size, feature6216)
end
def test_machine_stackoverflow