Skip to content
Snippets Groups Projects
Commit f9e5597d authored by Drew Blessing's avatar Drew Blessing Committed by GitLab Release Tools Bot
Browse files

Monkey patch of RDoc to prevent Ruby segfault

Merge branch 'security-dblessing_rdoc_puma-14-7' into '14-7-stable-ee'

See merge request gitlab-org/security/gitlab!2233

Changelog: security
parent dfd1d9f3
No related branches found
No related tags found
No related merge requests found
# frozen_string_literal: true
# Monkey patch of RDoc to prevent Ruby segfault due to
# stack buffer overflow Ruby bug -
# https://bugs.ruby-lang.org/issues/16376
#
# Safe to remove once GitLab upgrades to Ruby 3.0
# or once the fix is backported to 2.7.x and
# GitLab upgrades.
# https://gitlab.com/gitlab-org/gitlab/-/issues/351179
class RDoc::Markup::ToHtml
def parseable?(_)
false
end
end
class RDoc::Markup::Verbatim
def ruby?
false
end
end
# frozen_string_literal: true
RSpec.describe 'RDoc segfault patch fix' do
describe 'RDoc::Markup::ToHtml' do
describe '#parseable?' do
it 'returns false' do
to_html = RDoc::Markup::ToHtml.new( nil)
expect(to_html.parseable?('"def foo; end"')).to eq(false)
end
end
end
describe 'RDoc::Markup::Verbatim' do
describe 'ruby?' do
it 'returns false' do
verbatim = RDoc::Markup::Verbatim.new('def foo; end')
verbatim.format = :ruby
expect(verbatim.ruby?).to eq(false)
end
end
end
end
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment