Skip to content
Snippets Groups Projects
Commit 741a3556 authored by GitLab Release Tools Bot's avatar GitLab Release Tools Bot
Browse files

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

Monkey patch of RDoc to prevent Ruby segfault

See merge request gitlab-org/security/gitlab!2232
parents 68f2d1a8 14eec448
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