md_is_container_mark: Ordered list mark requires at least one digit. Fixes #95.
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 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__()`