commit a725fee3f670de5d91c44d54c0d1b4121ba28f13
parent c085ab5cfed594592ad9ad0b3d8a801cc2ef0db8
Author: Martin Mitas <mity@morous.org>
Date: Wed, 14 Dec 2016 16:51:24 +0100
md_enter_child_containers: Fix crash (issue #10).
Calling md_push_container_bytes() may result in ending a current block
which may result in removing some contents from ctx->block_bytes when
removing some lines with link reference definitions.
This in effect means we have to end the block explicitly before storing
the offset into the ctx->block_bytes.
Diffstat:
2 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/md4c/md4c.c b/md4c/md4c.c
@@ -4678,7 +4678,9 @@ md_enter_child_containers(MD_CTX* ctx, int n_children)
case _T('*'):
/* Remember offset in ctx->block_bytes so we can revisit the
* block if we detect it is a loose list. */
+ md_end_current_block(ctx);
c->block_byte_off = ctx->n_block_bytes;
+
MD_CHECK(md_push_container_bytes(ctx,
(is_ordered_list ? MD_BLOCK_OL : MD_BLOCK_UL),
c->start, MD_BLOCK_CONTAINER_OPENER));
diff --git a/test/coverage.txt b/test/coverage.txt
@@ -63,3 +63,18 @@ att2=tok2> bar</p>
bar</a></p>
</blockquote>
````````````````````````````````
+
+### [Issue 10](https://github.com/mity/md4c/issues/10)
+```````````````````````````````` example
+[x]:
+x
+- <?
+
+ x
+.
+<ul>
+<li><?
+<p>x</p>
+</li>
+</ul>
+````````````````````````````````