Bug #10282 ยป 0001-object.c-rb_class_real-do-not-dereference-0-VALUE.patch
object.c | ||
---|---|---|
VALUE
|
||
rb_class_real(VALUE cl)
|
||
{
|
||
if (cl == 0)
|
||
return 0;
|
||
while ((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS) {
|
||
while (cl &&
|
||
((RBASIC(cl)->flags & FL_SINGLETON) || BUILTIN_TYPE(cl) == T_ICLASS)) {
|
||
cl = RCLASS_SUPER(cl);
|
||
}
|
||
return cl;
|
test/ruby/test_module.rb | ||
---|---|---|
}
|
||
end
|
||
def test_inspect_segfault
|
||
bug_10282 = '[ruby-core:65214] [Bug #10282]'
|
||
assert_separately [], <<-RUBY
|
||
module ShallowInspect
|
||
def shallow_inspect
|
||
"foo"
|
||
end
|
||
end
|
||
module InspectIsShallow
|
||
include ShallowInspect
|
||
alias_method :inspect, :shallow_inspect
|
||
end
|
||
class A
|
||
end
|
||
A.prepend InspectIsShallow
|
||
expect = "#<Method: A(Object)#inspect(shallow_inspect)>"
|
||
assert_equal expect, A.new.method(:inspect).inspect, "#{bug_10282}"
|
||
RUBY
|
||
end
|
||
private
|
||
def assert_top_method_is_private(method)
|
||
-
|