Commit 2d2086aa05aeea49ec3706ccb0d3a3cce702a606

Martin Mitas 2016-11-23T11:20:25

md_is_table_underline: Check there is at least one pipe on the line.

diff --git a/md4c/md4c.c b/md4c/md4c.c
index c0655b7..f120867 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -4070,9 +4070,11 @@ static int
 md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count)
 {
     OFF off = beg;
+    int found_pipe = FALSE;
     unsigned col_count = 0;
 
     if(off < ctx->size  &&  CH(off) == _T('|')) {
+        found_pipe = TRUE;
         off++;
         while(off < ctx->size  &&  ISWHITESPACE(off))
             off++;
@@ -4100,6 +4102,7 @@ md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count)
             off++;
         if(off < ctx->size  &&  CH(off) == _T('|')) {
             delimited = TRUE;
+            found_pipe =  TRUE;
             off++;
             while(off < ctx->size  &&  ISWHITESPACE(off))
                 off++;
@@ -4113,6 +4116,9 @@ md_is_table_underline(MD_CTX* ctx, OFF beg, OFF* p_end, unsigned* p_col_count)
             return FALSE;
     }
 
+    if(!found_pipe)
+        return FALSE;
+
     *p_end = off;
     *p_col_count = col_count;
     return TRUE;