Skip to content

RDoc::Markdown.parse crashes with invalid inline note #655

@zelivans

Description

@zelivans

This bug is similar to #654, but the context is different and the bug itself is in another method.

Raw crash

/shared/rdoc/lib/rdoc/markdown.rb:15451:in `_InlineNote': undefined method `length' for nil:NilClass (NoMethodError)
	from /shared/rdoc/lib/rdoc/markdown.rb:481:in `apply'
	from /shared/rdoc/lib/rdoc/markdown.rb:9521:in `_Inline'
	from /shared/rdoc/lib/rdoc/markdown.rb:481:in `apply'
	from /shared/rdoc/lib/rdoc/markdown.rb:11888:in `_Label'
	from /shared/rdoc/lib/rdoc/markdown.rb:481:in `apply'
	from /shared/rdoc/lib/rdoc/markdown.rb:11750:in `_Reference'
	from /shared/rdoc/lib/rdoc/markdown.rb:481:in `apply'
	from /shared/rdoc/lib/rdoc/markdown.rb:12275:in `_References'
	from /shared/rdoc/lib/rdoc/markdown.rb:481:in `apply'
	from /shared/rdoc/lib/rdoc/markdown.rb:388:in `parse'
	from /shared/rdoc/lib/rdoc/markdown.rb:777:in `parse'
	from /shared/rdoc/lib/rdoc/markdown.rb:621:in `parse'
	from tst.rb:10:in `<main>'

Example input

[`^[0]

Explanation

It seems the _InlineNote method is called before note_order is initialized, and _InlineNote does not expect it to be nil, calling length on it without checking its value, resulting in a unhandled NoMethodError.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions