You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Using a Parser with LINKS_ALLOW_MATCHED_PARENTHESES = false.
When parsing a reasonably sized base64 image in markdown the parser has trouble matching and ends up with a StackOverflowError. Decreasing the size of the base64 image will eventually allow the regex to cope.
I found this because for the time being, I am using PegdownOptionsAdapter, which has that option enabled by default.
To Reproduce
Running:
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04)
OpenJDK 64-Bit Server VM (build 11.0.5+10-post-Ubuntu-0ubuntu1.118.04, mixed mode, sharing)
Enabling Parser.LINKS_ALLOW_MATCHED_PARENTHESES avoid the regular expressions which I think is the culprit in InlineParserImpl#parseLinkDestination:1168:
I have been trying to figure out which option causes this and even have a hand-rolled parser to replace the regex one, which does not have the issue. However, in some cases the stack overflow is still caused and I have not been able to isolate exactly what causes this.
I will take another look through the code to see what other parts of code use this regex but in the mean time I will disable this feature by default.
@mrombout, my bad. I completely forgot about the matched parens option and my hand-rolled parser, which does not suffer from stack overflow, is bypassed if this option is not selected. Thus the continued stack overflow occurrences.
I am adding a flag to the state machine parser for no parens and will have it parsing in both cases without regex.
Thank you for bringing this up. It was on my to do list and nagging me to figure it out. Your finding pointed me in the right direction.
Describe the bug
Most likely the same, or similar issue as #364.
Using a
Parser
withLINKS_ALLOW_MATCHED_PARENTHESES = false
.When parsing a reasonably sized base64 image in markdown the parser has trouble matching and ends up with a
StackOverflowError
. Decreasing the size of the base64 image will eventually allow the regex to cope.I found this because for the time being, I am using
PegdownOptionsAdapter
, which has that option enabled by default.To Reproduce
Running:
See https://github.com/mrombout/flexmark-so-sscce, or below.
Expected behavior
Output an image tag with the base64 data.
Additional context
Enabling
Parser.LINKS_ALLOW_MATCHED_PARENTHESES
avoid the regular expressions which I think is the culprit inInlineParserImpl#parseLinkDestination:1168
:The text was updated successfully, but these errors were encountered: