Commit 3ec2a19596cdd1131046193509ca26ccc4f05d9a

Martin Mitas 2016-12-15T23:57:58

md_analyze_backtick: Ensire that code span opener and closer do not overlap.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/md4c/md4c.c b/md4c/md4c.c
index ef92e69..dd5edee 100644
--- a/md4c/md4c.c
+++ b/md4c/md4c.c
@@ -2685,8 +2685,10 @@ md_analyze_backtick(MD_CTX* ctx, int mark_index)
              * itself to swallow it. */
             while(CH(opener->end) == _T(' ')  ||  ISNEWLINE(opener->end))
                 opener->end++;
-            while(CH(mark->beg-1) == _T(' ')  ||  ISNEWLINE(mark->beg-1))
-                mark->beg--;
+            if(mark->beg > opener->end) {
+                while(CH(mark->beg-1) == _T(' ')  ||  ISNEWLINE(mark->beg-1))
+                    mark->beg--;
+            }
 
             /* Done. */
             return;