diff options
author | NARUSE, Yui <naruse@airemix.jp> | 2022-01-30 19:02:23 +0900 |
---|---|---|
committer | NARUSE, Yui <naruse@airemix.jp> | 2022-01-30 19:02:23 +0900 |
commit | d3a2a3c5420fecfee54cbf3fbdd9287bc6c58f03 (patch) | |
tree | 604b98ac5078c53e1bf692534459c07135b9f891 /test | |
parent | 2640161df5cf18d08ec86a0c1b913d4ee99e102a (diff) |
merge revision(s) 9e0a91d0640600f2dfd7fc1d5fae6667019c9ca5: [Backport #18458]
Don't segfault if Warning.warn is undefined
Check that there is a method entry for the method before passing
it to rb_method_entry_arity.
Fixes [Bug #18458]
---
error.c | 3 ++-
test/ruby/test_exception.rb | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_exception.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 67f38c2e91..c8746359fd 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -1200,6 +1200,14 @@ $stderr = $stdout; raise "\x82\xa0"') do |outs, errs, status| assert_empty warning end + def test_undef_Warning_warn + assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") + begin; + Warning.undef_method(:warn) + assert_raise(NoMethodError) { warn "" } + end; + end + def test_undefined_backtrace assert_separately([], "#{<<-"begin;"}\n#{<<-"end;"}") begin; |