From 001b77f0dd1cefb863de5925bbdefe310c29e2c5 Mon Sep 17 00:00:00 2001 From: Yuki Izumi Date: Wed, 12 Jul 2017 18:37:48 +1000 Subject: [PATCH] > 32 nested balanced parens in a link is bananas --- src/inlines.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/inlines.c b/src/inlines.c index 2f907b185..e30c2affe 100644 --- a/src/inlines.c +++ b/src/inlines.c @@ -871,6 +871,8 @@ static bufsize_t manual_scan_link_url(cmark_chunk *input, bufsize_t offset) { else if (input->data[i] == '(') { ++nb_p; ++i; + if (nb_p > 32) + return -1; } else if (input->data[i] == ')') { if (nb_p == 0) break;