adjust two regex pattern within inlineLink() to reduce backtracking

add test with base64 image
This commit is contained in:
gene_sis 2017-01-06 20:40:19 +01:00
parent 20ff8bbb57
commit 48351504de
3 changed files with 7 additions and 4 deletions

View File

@ -1204,7 +1204,7 @@ class Parsedown
$remainder = $Excerpt['text'];
if (preg_match('/\[((?:[^][]|(?R))*)\]/', $remainder, $matches))
if (preg_match('/\[((?:[^][]++|(?R))*+)\]/', $remainder, $matches))
{
$Element['text'] = $matches[1];
@ -1217,7 +1217,7 @@ class Parsedown
return;
}
if (preg_match('/^[(]((?:[^ ()]|[(][^ )]+[)])+)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
if (preg_match('/^[(]((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*"|\'[^\']*\'))?[)]/', $remainder, $matches))
{
$Element['attributes']['href'] = $matches[1];

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long