diff --git a/lib/markdown2.py b/lib/markdown2.py index 8d073cad..23300ac7 100755 --- a/lib/markdown2.py +++ b/lib/markdown2.py @@ -2574,7 +2574,9 @@ class GFMItalicAndBoldProcessor(Extra): def run(self, text): nesting = True - while nesting: + orig_text = "" + while nesting and orig_text != _hash_text(text): + orig_text = _hash_text(text) nesting = False opens = {'*': [], '_': []} diff --git a/test/test_redos.py b/test/test_redos.py index 180ce931..fb1147e0 100644 --- a/test/test_redos.py +++ b/test/test_redos.py @@ -37,17 +37,23 @@ def issue_633(): # https://github.com/trentm/python-markdown2/issues/633 return '