Commit 0354e1ab5a453e9913dcd5f87c2cfe9a2510dfda

Martin Mitas 2019-10-04T22:34:08

md_is_container_mark: Ordered list mark requires at least one digit. Fixes #95.

diff --git a/CHANGELOG.md b/CHANGELOG.md
index de6bdce..93258cf 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -17,6 +17,9 @@ Fixes:
    `md_build_ref_def_hashtable()`: Do not allocate more memory then strictly
    needed.
 
+ * [#95](https://github.com/mity/md4c/issues/95):
+   `md_is_container_mark()`: Ordered list mark requires at least one digit.
+
 
 ## Version 0.3.4
 
diff --git a/md4c/md4c.c b/md4c/md4c.c
index f2a24f9..3745cf3 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -5486,7 +5486,10 @@ md_is_container_mark(MD_CTX* ctx, unsigned indent, OFF beg, OFF* p_end, MD_CONTA
         p_container->start = p_container->start * 10 + CH(off) - _T('0');
         off++;
     }
-    if(off+1 < ctx->size  &&  (CH(off) == _T('.') || CH(off) == _T(')'))   &&  (ISBLANK(off+1) || ISNEWLINE(off+1))) {
+    if(off > beg  &&  off+1 < ctx->size  &&
+       (CH(off) == _T('.') || CH(off) == _T(')'))  &&
+       (ISBLANK(off+1) || ISNEWLINE(off+1)))
+    {
         p_container->ch = CH(off);
         p_container->is_loose = FALSE;
         p_container->is_task = FALSE;
diff --git a/test/coverage.txt b/test/coverage.txt
index 031be3c..7ff297f 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -204,6 +204,15 @@ foo
 ````````````````````````````````
 
 
+### [Issue 95](https://github.com/mity/md4c/issues/95)
+
+```````````````````````````````` example
+. foo
+.
+<p>. foo</p>
+````````````````````````````````
+
+
 ## Code coverage
 
 ### `md_is_unicode_whitespace__()`