rdoc icon indicating copy to clipboard operation
rdoc copied to clipboard

RDoc::Markdown.parse crashes with invalid footnote

Open zelivans opened this issue 7 years ago • 0 comments

The third bug found by fuzzing rdoc markdown, similar to https://github.com/ruby/rdoc/issues/654.

Raw crash

/shared/rdoc/lib/rdoc/markdown.rb:802:in `block in parse': undefined method `parts' for nil:NilClass (NoMethodError)
	from /shared/rdoc/lib/rdoc/markdown.rb:797:in `each'
	from /shared/rdoc/lib/rdoc/markdown.rb:797:in `each_with_index'
	from /shared/rdoc/lib/rdoc/markdown.rb:797:in `parse'
	from /shared/rdoc/lib/rdoc/markdown.rb:621:in `parse'
	from tst.rb:10:in `<main>'

Example input

^[[^[]]

Explanation

In the main parse method, @footnotes[ref] to returns nil, and then the call to note.parts.unshift results in an unhandled NoMethodError.

zelivans avatar Sep 22 '18 13:09 zelivans