cmark

My personal build of CMark ✏️

Commit
5d16af6b134477d0e9b281cd1e9d962dc52b5088
Parent
d8226ea031f61572f397af0735ec32c6ab0a231a
Author
John MacFarlane <jgm@berkeley.edu>
Date

Check for `[` character in `link_label`.

Closes #226.

Diffstat

1 file changed, 8 insertions, 2 deletions

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 10 8 2
diff --git a/src/inlines.c b/src/inlines.c
@@ -617,9 +617,15 @@ static int link_label(subject* subj, chunk *raw_label)
 {
 	int startpos = subj->pos;
 	int length = 0;
-
-	advance(subj);  // advance past [
 	unsigned char c;
+
+	// advance past [
+	if (peek_char(subj) == '[') {
+		advance(subj);
+	} else {
+		return 0;
+	}
+
 	while ((c = peek_char(subj)) && c != '[' && c != ']') {
 		if (c == '\\') {
 			advance(subj);