-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Milestone
Description
In debugging the behavior of CGI::Escape (a C ext added in Ruby 2.3) I discovered problems with the superclass logic surrounding prepended and extended modules.
Specifically, the following example will blow out the stack:
module X; end
class Foo; extend X; end
module Y; def blah; super; end; end
module X; prepend Y; end
class Foo; extend Y; end; Foo.blahSmall changes in order here will work properly, producing an error about "blah" not being available on Foo (for the super call).
For example, this works:
module Y; def blah; super; end; end
module X; prepend Y; end
class Foo; extend X; end
class Foo; extend Y; end; Foo.blahFor the moment I will modify the order in which these operations happen in the cgi library to get the related tests passing. Specifically, these fail:
test/ruby/cgi/test_cgi_util.rb
Encoding.list.each do |enc|
begin
escaped = "'&"><".encode(enc)
unescaped = "'&\"><".encode(enc)
rescue Encoding::ConverterNotFoundError
next
else
define_method("test_cgi_escapeHTML:#{enc.name}") do
assert_equal(escaped, CGI::escapeHTML(unescaped))
end
define_method("test_cgi_unescapeHTML:#{enc.name}") do
assert_equal(unescaped, CGI::unescapeHTML(escaped))
end
end
endAny non-ascii passed to these new optimized methods will hit the problem.
I believe this affects JRuby 9.1.8.0.
Reactions are currently unavailable