Skip to content

Commit 6b7ee52

Browse files
committed
change the match to full match and updating the regex for CVE-2026-44899
1 parent 542f6cc commit 6b7ee52

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/mistune/directives/image.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
__all__ = ["Image", "Figure"]
1515

16-
_num_re = re.compile(r"^\d+(?:\.\d*)?(?:px|ch|em|rem|ex|rex|vw|vh|%)?$")
16+
_num_re = re.compile(r"^\d+(?:\.\d+)?(?:px|ch|em|rem|ex|rex|vw|vh|%)?$")
1717
_allowed_aligns = ["top", "middle", "bottom", "left", "center", "right"]
1818

1919

@@ -29,9 +29,9 @@ def _parse_attrs(options: Dict[str, Any]) -> Dict[str, Any]:
2929

3030
height = options.get("height")
3131
width = options.get("width")
32-
if height and _num_re.match(height):
32+
if height and _num_re.fullmatch(height):
3333
attrs["height"] = height
34-
if width and _num_re.match(width):
34+
if width and _num_re.fullmatch(width):
3535
attrs["width"] = width
3636
if "target" in options:
3737
attrs["target"] = escape_url(options["target"])

0 commit comments

Comments
 (0)