mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Fix segfault on remove_method with invalid argument
Reported by https://hackerone.com/jpenalbae
This commit is contained in:
@@ -401,3 +401,12 @@ assert('class with non-class/module outer raises TypeError') do
|
||||
assert_raise(TypeError) { class 0::C1; end }
|
||||
assert_raise(TypeError) { class []::C2; end }
|
||||
end
|
||||
|
||||
assert("remove_method doesn't segfault if the passed in argument isn't a symbol") do
|
||||
klass = Class.new
|
||||
assert_raise(TypeError) { klass.remove_method nil }
|
||||
assert_raise(TypeError) { klass.remove_method 123 }
|
||||
assert_raise(TypeError) { klass.remove_method 1.23 }
|
||||
assert_raise(NameError) { klass.remove_method "hello" }
|
||||
assert_raise(TypeError) { klass.remove_method Class.new }
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user