cmark

My personal build of CMark ✏️

Commit
7767b22ab12aa4ab43ae389771617078248a4b84
Parent
240400e1c397c6b379c0c7c21d1ec658dbb24153
Author
John MacFarlane <jgm@berkeley.edu>
Date

Don't allow link labels with no non-whitespace characters.

See jgm/CommonMark#322.

Diffstat

1 file changed, 2 insertions, 1 deletion

Status File Name N° Changes Insertions Deletions
Modified src/inlines.c 3 2 1
diff --git a/src/inlines.c b/src/inlines.c
@@ -755,6 +755,7 @@ static int link_label(subject* subj, cmark_chunk *raw_label)
 
 	if (c == ']') { // match found
 		*raw_label = cmark_chunk_dup(&subj->input, startpos + 1, subj->pos - (startpos + 1));
+		cmark_chunk_trim(raw_label);
 		advance(subj);  // advance past ]
 		return 1;
 	}
@@ -1111,7 +1112,7 @@ int cmark_parse_reference_inline(cmark_strbuf *input, cmark_reference_map *refma
 	subject_from_buf(&subj, input, NULL);
 
 	// parse label:
-	if (!link_label(&subj, &lab))
+	if (!link_label(&subj, &lab) || lab.len == 0)
 		return 0;
 
 	// colon: