Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rouge may crash when formatting tokens if options are used with lexer instance #1175

Closed
mojavelinux opened this issue Jun 12, 2019 · 2 comments · Fixed by #1178
Closed

Rouge may crash when formatting tokens if options are used with lexer instance #1175

mojavelinux opened this issue Jun 12, 2019 · 2 comments · Fixed by #1178

Comments

@mojavelinux
Copy link
Contributor

Rouge will sometimes crash when formatting tokens that were created using a lexer instance that was used with options.

The problem stems from a typo in the Lexer#lex method. Here's the problematic line:

rouge/lib/rouge/lexer.rb

Lines 421 to 424 in 6d62ba1

if opts
warn 'the :continue option to Formatter#lex is deprecated, use #continue_lex instead.'
return continue_lex(string, &b)
end

The code is not actually checking for the :continue option, which can send the application down the wrong code path. As a result, very bizarre things start to happen.

mojavelinux added a commit to mojavelinux/rouge that referenced this issue Jun 12, 2019
@bbatsov
Copy link

bbatsov commented Jun 12, 2019

I was just about report this! 😃 Thanks, @mojavelinux!

@mojavelinux
Copy link
Contributor Author

Already have a fix too...because I was super curious ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants