Commit f32a861efaff464e1c6af36679f2e7382a6b0e0a

Martin Mitas 2024-01-11T12:20:23

md_end_current_block: Fix EOL handling.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/md4c.c b/src/md4c.c
index 0d384ad..21c2ed9 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -5069,7 +5069,7 @@ md_end_current_block(MD_CTX* ctx)
        (ctx->current_block->type == MD_BLOCK_H  &&  (ctx->current_block->flags & MD_BLOCK_SETEXT_HEADER)))
     {
         MD_LINE* lines = (MD_LINE*) (ctx->current_block + 1);
-        if(CH(lines[0].beg) == _T('[')) {
+        if(lines[0].beg < ctx->size  &&  CH(lines[0].beg) == _T('[')) {
             MD_CHECK(md_consume_link_reference_definitions(ctx));
             if(ctx->current_block == NULL)
                 return ret;