Skip to content

Commit 1d17fa9

Browse files
Fix GHSL-2023-119: prevent quadratic performance by not allowing very deeply nested footnote definitions.
1 parent 1e23082 commit 1d17fa9

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/blocks.c

+2-1
Original file line numberDiff line numberDiff line change
@@ -1217,7 +1217,8 @@ static void open_new_blocks(cmark_parser *parser, cmark_node **container,
12171217
parser->first_nonspace + 1);
12181218
S_advance_offset(parser, input, input->len - 1 - parser->offset, false);
12191219
} else if (!indented &&
1220-
parser->options & CMARK_OPT_FOOTNOTES &&
1220+
(parser->options & CMARK_OPT_FOOTNOTES) &&
1221+
depth < MAX_LIST_DEPTH &&
12211222
(matched = scan_footnote_definition(input, parser->first_nonspace))) {
12221223
cmark_chunk c = cmark_chunk_dup(input, parser->first_nonspace + 2, matched - 2);
12231224
cmark_chunk_to_cstr(parser->mem, &c);

0 commit comments

Comments
 (0)