File tree Expand file tree Collapse file tree 2 files changed +18
-10
lines changed
Expand file tree Collapse file tree 2 files changed +18
-10
lines changed Original file line number Diff line number Diff line change @@ -2574,7 +2574,9 @@ class GFMItalicAndBoldProcessor(Extra):
25742574
25752575 def run (self , text ):
25762576 nesting = True
2577- while nesting :
2577+ orig_text = ""
2578+ while nesting and orig_text != _hash_text (text ):
2579+ orig_text = _hash_text (text )
25782580 nesting = False
25792581
25802582 opens = {'*' : [], '_' : []}
Original file line number Diff line number Diff line change @@ -37,17 +37,23 @@ def issue_633():
3737 # https://github.com/trentm/python-markdown2/issues/633
3838 return '<p m="1"' * 2500 + " " * 5000 + "</div"
3939
40+ def issue_668 ():
41+ # https://github.com/trentm/python-markdown2/issues/668
42+ # not technically a redos, but still an error that caused a DOS
43+ return 'a_b **x***y* c_d'
44+
4045
4146# whack everything in a dict for easy lookup later on
4247CASES = {
43- fn .__name__ : fn
44- for fn in [
45- pull_387_example_1 ,
46- pull_387_example_2 ,
47- pull_387_example_3 ,
48- pull_402 ,
49- issue493 ,
50- issue_633 ,
48+ fn .__name__ : (fn , extras )
49+ for fn , extras in [
50+ (pull_387_example_1 , None ),
51+ (pull_387_example_2 , None ),
52+ (pull_387_example_3 , None ),
53+ (pull_402 , None ),
54+ (issue493 , None ),
55+ (issue_633 , None ),
56+ (issue_668 , ['code-friendly' ]),
5157 ]
5258}
5359
@@ -60,7 +66,7 @@ def issue_633():
6066 sys .path .insert (0 , str (LIB_DIR ))
6167 from markdown2 import markdown
6268
63- markdown (testcase () )
69+ markdown (testcase [ 0 ](), extras = testcase [ 1 ] )
6470 sys .exit (0 )
6571
6672 print ("-- ReDoS tests" )
You can’t perform that action at this time.
0 commit comments