Skip to content

Commit

Permalink
Reset TABLECELLBOUNDARIES with ordinary opener chains.
Browse files Browse the repository at this point in the history
This is needed because special handling of '|' is now done also if the
wiki-links extension is enabled so the chain is populated even with that
extension.

Fixes #174.
  • Loading branch information
mity committed Jan 14, 2022
1 parent a470fbf commit 62b6097
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ Fixes:
Fix quadratic time behavior caused by unnecessary lookup for link reference
definition even if the potential label contains nested brackets.

* [#173](https://github.com/mity/md4c/issues/173):
Fix broken internal state invoked by devilish combination of syntax
constructions.
* [#173](https://github.com/mity/md4c/issues/173),
[#174](https://github.com/mity/md4c/issues/174):
Multiple bugs identified with oss-fuzz were fixed.


## Version 0.4.8
Expand Down
8 changes: 7 additions & 1 deletion src/md4c.c
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,7 @@ struct MD_CTX_tag {
#define TILDE_OPENERS_2 (ctx->mark_chains[10])
#define BRACKET_OPENERS (ctx->mark_chains[11])
#define DOLLAR_OPENERS (ctx->mark_chains[12])
#define OPENERS_CHAIN_FIRST 2
#define OPENERS_CHAIN_FIRST 1
#define OPENERS_CHAIN_LAST 12

int n_table_cell_boundaries;
Expand Down Expand Up @@ -2650,6 +2650,10 @@ md_rollback(MD_CTX* ctx, int opener_index, int closer_index, int how)
int i;
int mark_index;

fprintf(stderr, "md_rollback: %d ... %d [%s]\n",
ctx->marks[opener_index].beg, ctx->marks[closer_index].beg,
(how == MD_ROLLBACK_ALL ? "all" : "crossing"));

/* Cut all unresolved openers at the mark index. */
for(i = OPENERS_CHAIN_FIRST; i < OPENERS_CHAIN_LAST+1; i++) {
MD_MARKCHAIN* chain = &ctx->mark_chains[i];
Expand Down Expand Up @@ -3439,6 +3443,8 @@ md_resolve_links(MD_CTX* ctx, const MD_LINE* lines, int n_lines)
MD_LINK_ATTR attr;
int is_link = FALSE;

fprintf(stderr, "md_resolve_links: %d ... %d\n", opener->beg, closer->beg);

if(next_index >= 0) {
next_opener = &ctx->marks[next_index];
next_closer = &ctx->marks[next_opener->next];
Expand Down

0 comments on commit 62b6097

Please sign in to comment.