Reset TABLECELLBOUNDARIES with ordinary opener chains. 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.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
diff --git a/CHANGELOG.md b/CHANGELOG.md
index ccf7c74..eccf901 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -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
diff --git a/src/md4c.c b/src/md4c.c
index 779f808..5cdffe1 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -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;
@@ -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];
@@ -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];