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

MMD hangs when a list item contains only a backslash #30

Closed
antons opened this issue Jul 29, 2016 · 5 comments
Closed

MMD hangs when a list item contains only a backslash #30

antons opened this issue Jul 29, 2016 · 5 comments

Comments

@antons
Copy link

antons commented Jul 29, 2016

One of our customers discovered that MMD parser hangs when a list item (either bulleted or ordered) contains only a backslash:

* \
1. \

We reproduced the issue as far back as 5.0.1, but did not try versions earlier than that.

@fletcher
Copy link
Owner

I can't reproduce it, either in latest release or development version, or in 5.0.1.

Parsing the file you give me results in the following:

<ul>
<li>
</li>
<li>
</li>
</ul>

Can you be more specific about how to replicate this?

Thanks!

@antons
Copy link
Author

antons commented Jul 30, 2016

@fletcher I forgot to check which extensions we are using. The hang happens only with escaped-line-breaks.

@antons
Copy link
Author

antons commented Jul 30, 2016

I should note that only one line is enough. This alone triggers it:

* \

And this too:

1. \

@fletcher
Copy link
Owner

That did it. I can reproduce. Now just need to track down the source of the problem. Thanks!

fletcher added a commit that referenced this issue Aug 3, 2016
@fletcher
Copy link
Owner

fletcher commented Aug 3, 2016

UPDATE: Spent a lot of time trying to track this down. Interestingly, during my work the problem began to reproduce itself both with and without the escaped line breaks option. I couldn't identify a specific problem with the PEG recipes.

The problem is that when a list item contains only "", then the parser tries to process the raw block "\n". For whatever reason, that causes the parser to fail to match, and to endlessly cycle through "recipes" looking for a match. I'm not sure why this happens, and certainly welcome any input.

That said, I am able to prevent the error from reaching the user by ensuring that there is something left in the buffer before continuously cycling through the yyparse() function. A description of the problem is added to the source (parser.leg -> process_raw_blocks()).

I will leave this open for now, as I would prefer a real fix rather than just avoiding the problem. At least until MMD 6 exists. ;)

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

No branches or pull requests

2 participants