Skip to content

Commit

Permalink
md_is_link_title: Stop on ')' lin ()-style title.
Browse files Browse the repository at this point in the history
Fixes #60.
  • Loading branch information
mity committed Mar 11, 2019
1 parent fc27108 commit 966b8e3
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Fixes:

* Fixed some quadratic behaviors:
[#58](https://github.com/mity/md4c/issues/58),
[#59](https://github.com/mity/md4c/issues/59)
[#59](https://github.com/mity/md4c/issues/59),
[#60](https://github.com/mity/md4c/issues/60)

* [#61](https://github.com/mity/md4c/issues/59): Flag `MD_FLAG_NOHTMLSPANS`
erroneously affected also recognition of CommonMark autolinks.
Expand Down
3 changes: 3 additions & 0 deletions md4c/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -2058,6 +2058,9 @@ md_is_link_title(MD_CTX* ctx, const MD_LINE* lines, int n_lines, OFF beg,
*p_end = off+1;
*p_end_line_index = line_index;
return TRUE;
} else if(closer_char == _T(')') && CH(off) == _T('(')) {
/* ()-style title cannot contain (unescaped '(')) */
return FALSE;
}

off++;
Expand Down
5 changes: 4 additions & 1 deletion test/pathological_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@
re.compile("(<>){50000}")),
"many backticks and escapes":
(("\\``" * 50000),
re.compile("(``){50000}"))
re.compile("(``){50000}")),
"many broken link titles":
(("[ (](" * 50000),
re.compile("(\[ \(\]\(){50000}"))
}

whitespace_re = re.compile('/s+/')
Expand Down

0 comments on commit 966b8e3

Please sign in to comment.