[Bug #19774] Fix segfault at return
in END
This commit is contained in:
parent
ac7d34026a
commit
fe4d906f5f
Notes:
git
2023-07-18 18:40:35 +00:00
@ -461,7 +461,12 @@ exiting_split(VALUE errinfo, volatile int *exitcode, volatile int *sigstatus)
|
|||||||
|
|
||||||
if (NIL_P(errinfo)) return 0;
|
if (NIL_P(errinfo)) return 0;
|
||||||
|
|
||||||
if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
|
if (THROW_DATA_P(errinfo)) {
|
||||||
|
int throw_state = ((const struct vm_throw_data *)errinfo)->throw_state;
|
||||||
|
ex = throw_state & VM_THROW_STATE_MASK;
|
||||||
|
result |= EXITING_WITH_STATUS;
|
||||||
|
}
|
||||||
|
else if (rb_obj_is_kind_of(errinfo, rb_eSystemExit)) {
|
||||||
ex = sysexit_status(errinfo);
|
ex = sysexit_status(errinfo);
|
||||||
result |= EXITING_WITH_STATUS;
|
result |= EXITING_WITH_STATUS;
|
||||||
}
|
}
|
||||||
|
@ -1370,6 +1370,7 @@ eom
|
|||||||
nil&defined?0--begin e=no_method_error(); return; 0;end
|
nil&defined?0--begin e=no_method_error(); return; 0;end
|
||||||
return puts('ignored') #=> ignored
|
return puts('ignored') #=> ignored
|
||||||
BEGIN {return}
|
BEGIN {return}
|
||||||
|
END {return if false}
|
||||||
end;
|
end;
|
||||||
.split(/\n/).map {|s|[(line+=1), *s.split(/#=> /, 2)]}
|
.split(/\n/).map {|s|[(line+=1), *s.split(/#=> /, 2)]}
|
||||||
failed = proc do |n, s|
|
failed = proc do |n, s|
|
||||||
@ -1407,6 +1408,10 @@ eom
|
|||||||
assert_in_out_err(['-e', 'class TestSyntax; proc{ return }.call; end'], "", [], /^-e:1:.*unexpected return \(LocalJumpError\)/)
|
assert_in_out_err(['-e', 'class TestSyntax; proc{ return }.call; end'], "", [], /^-e:1:.*unexpected return \(LocalJumpError\)/)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_return_in_END
|
||||||
|
assert_normal_exit('END {return}')
|
||||||
|
end
|
||||||
|
|
||||||
def test_syntax_error_in_rescue
|
def test_syntax_error_in_rescue
|
||||||
bug12613 = '[ruby-core:76531] [Bug #12613]'
|
bug12613 = '[ruby-core:76531] [Bug #12613]'
|
||||||
assert_syntax_error("#{<<-"begin;"}\n#{<<-"end;"}", /Invalid retry/, bug12613)
|
assert_syntax_error("#{<<-"begin;"}\n#{<<-"end;"}", /Invalid retry/, bug12613)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user