php-markdown icon indicating copy to clipboard operation
php-markdown copied to clipboard

Catastrophic backtracking with large inline image

Open herndlm opened this issue 1 year ago • 2 comments

Hi,

with both Markdown and MarkdownExtra there are issues with very long content like inline images. https://github.com/michelf/php-markdown/blob/51613168d71787b0fe8472166ccbfa8d285c02cd/Michelf/MarkdownExtra.php#L1065-L1071 and also the simpler https://github.com/michelf/php-markdown/blob/51613168d71787b0fe8472166ccbfa8d285c02cd/Michelf/Markdown.php#L903-L904 lead to "Backtrack limit exhausted" errors and empty content with the default pcre.backtrack_limit of 1000000. I was about to create a re-producer, but I basically see the same issue on regex101.com and it might be simpler to play around with there: https://regex101.com/r/BcWE82/1

Do you think this is something that can be improved or is it suggested to increase pcre.backtrack_limit to deal with this? This could be the same as #149

herndlm avatar Mar 11 '24 19:03 herndlm