Commit c058e82c6a939f591059672dab08ddd0d4ce416e

Martin Mitas 2022-01-10T12:34:57

md_is_table_underline: Fix detection by the end of file. This was a regression in a8bb4d3020eb1cfa07f01241c2aa668d91011cb5.

1
2
3
4
5
6
7
8
9
10
11
12
13
diff --git a/src/md4c.c b/src/md4c.c
index 42a3289..1af50b7 100644
--- a/src/md4c.c
+++ b/src/md4c.c
@@ -5250,7 +5250,7 @@ md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count)
         /* Cell underline ("-----", ":----", "----:" or ":----:") */
         if(off < ctx->size  &&  CH(off) == _T(':'))
             off++;
-        if(off < ctx->size  &&  CH(off) != _T('-'))
+        if(off >= ctx->size  ||  CH(off) != _T('-'))
             return FALSE;
         while(off < ctx->size  &&  CH(off) == _T('-'))
             off++;