summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn MacFarlane <jgm@berkeley.edu>2019-04-03 10:24:32 -0700
committerJohn MacFarlane <jgm@berkeley.edu>2019-04-03 10:24:32 -0700
commitc56aa1514f04a5e369b35e92cf56186575a40af1 (patch)
tree0fcb58f2e299ac0962b121e1d44f73eda87b6066 /src
parent732207b00176856dd8101a27e8d31a90926fa4da (diff)
Allow empty `<>` link destination in reference link.
Diffstat (limited to 'src')
-rw-r--r--src/inlines.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/inlines.c b/src/inlines.c
index 6f93fd4..458ab72 100644
--- a/src/inlines.c
+++ b/src/inlines.c
@@ -938,10 +938,14 @@ static bufsize_t manual_scan_link_url_2(cmark_chunk *input, bufsize_t offset,
break;
--nb_p;
++i;
- } else if (cmark_isspace(input->data[i]))
+ } else if (cmark_isspace(input->data[i])) {
+ if (i == offset) {
+ return -1;
+ }
break;
- else
+ } else {
++i;
+ }
}
if (i >= input->len)
@@ -1337,8 +1341,7 @@ bufsize_t cmark_parse_reference_inline(cmark_mem *mem, cmark_chunk *input,
// parse link url:
spnl(&subj);
- if ((matchlen = manual_scan_link_url(&subj.input, subj.pos, &url)) > -1 &&
- url.len > 0) {
+ if ((matchlen = manual_scan_link_url(&subj.input, subj.pos, &url)) > -1) {
subj.pos += matchlen;
} else {
return 0;