Skip to content

Commit b77ee58

Browse files
committed
fix: prevent deep alt parsing
1 parent 66b2171 commit b77ee58

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

src/mistune/_inline/links.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ def parse_link(inline: "InlineParser", m: Match[str], state: InlineState) -> Opt
2121
marker = m.group(0)
2222
is_image = marker[0] == "!"
2323
if is_image and inline.max_image_depth > 0 and state.image_depth >= inline.max_image_depth:
24-
state.append_token({"type": "text", "raw": marker})
25-
return pos
24+
state.append_token({"type": "text", "raw": marker + state.src[pos:]})
25+
return len(state.src)
2626
if not is_image and state.in_link:
2727
state.append_token({"type": "text", "raw": marker})
2828
return pos

0 commit comments

Comments
 (0)