md_is_code_span: Fix crash at EOF. Fixes #65.
diff --git a/md4c/md4c.c b/md4c/md4c.c
index 50976d2..fc5a72a 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -2785,7 +2785,7 @@ md_is_code_span(MD_CTX* ctx, OFF beg, OFF max_end,
if(closer_end - closer_beg == mark_len)
break;
- if(closer_end - closer_beg < CODESPAN_MARK_MAXLEN) {
+ if(closer_end - closer_beg > 0 && closer_end - closer_beg < CODESPAN_MARK_MAXLEN) {
if(closer_beg > last_potential_closers[closer_end - closer_beg - 1])
last_potential_closers[closer_end - closer_beg - 1] = closer_beg;
}
diff --git a/test/coverage.txt b/test/coverage.txt
index 345d5d7..07121f5 100644
--- a/test/coverage.txt
+++ b/test/coverage.txt
@@ -151,6 +151,14 @@ __x_ _x___
````````````````````````````````
+### [Issue 65](https://github.com/mity/md4c/issues/65)
+```````````````````````````````` example
+`
+.
+<p>`</p>
+````````````````````````````````
+
+
## Code coverage