diff --git a/src/inlines.c b/src/inlines.c index 9143bbb5f..bf765eab5 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -1495,6 +1495,10 @@ bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input, if (!skip_line_end(&subj)) { return 0; } + // the previously scanned title turned out to be invalid (it was + // followed by trailing garbage instead of the end of the line), so + // the reference has no title after all. + title = cmark_chunk_literal(""); } else { return 0; } diff --git a/test/regression.txt b/test/regression.txt index 4140ba2d1..2eb818444 100644 --- a/test/regression.txt +++ b/test/regression.txt @@ -321,3 +321,13 @@ Issue #611:
"The title" garbage +bla
+````````````````````````````````