Skip to content

Commit

Permalink
Fix asteris emphasis regex CVE-2022-34749
Browse files Browse the repository at this point in the history
  • Loading branch information
lepture committed Jul 1, 2022
1 parent 5638e46 commit a6d4321
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 16 deletions.
4 changes: 2 additions & 2 deletions mistune/inline_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ class InlineParser(ScannerParser):
#: _emphasis_ __strong__
ASTERISK_EMPHASIS = (
r'(\*{1,2})(?=[^\s*])('
r'(?:\\[\\*]|[^*])*'
r'(?:' + ESCAPE_TEXT + r'|[^\s*]))\1'
r'(?:(?:(?<!\\)(?:\\\\)*\*)|[^*])+'
r')(?<!\\)\1'
)
UNDERSCORE_EMPHASIS = (
r'\b(_{1,2})(?=[^\s_])([\s\S]*?'
Expand Down
14 changes: 0 additions & 14 deletions tests/fixtures/non-commonmark.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,6 @@
<p>[link [foo [bar]]](/uri)</p>
````````````````````````````````

```````````````````````````````` example
[link *foo **bar** `#`*](/uri)
.
<p><a href="/uri">link *foo <strong>bar</strong> <code>#</code>*</a></p>
````````````````````````````````

```````````````````````````````` example
[foo [bar](/uri)](/uri)
.
Expand Down Expand Up @@ -48,14 +42,6 @@
<p><a href="uri">foo&lt;http://example.com/?search=</a>&gt;</p>
````````````````````````````````

```````````````````````````````` example
[link *foo **bar** `#`*][ref]

[ref]: /uri
.
<p><a href="/uri">link *foo <strong>bar</strong> <code>#</code>*</a></p>
````````````````````````````````

```````````````````````````````` example
[foo [bar](/uri)][ref]

Expand Down

0 comments on commit a6d4321

Please # to comment.