New submission from James Davis :
I have two regexes: /(a|ab)*?b/ and /(ab|a)*?b/.
If I re.search the string "ab" for these regexes, I get inconsistent behavior.
Specifically, /(a|ab)*?b/ matches with capture "a", while /(ab|a)*?b/ matches
with an empty capture group.
I
James Davis added the comment:
Thanks for your thoughts, Raymond. I understand that the alternation has
"short-circuit" behavior, but I still find it confusing in this case.
Consider these two:
Regex patternmatched? matched string capture
New submission from James Davis :
Hi Python security team,
My name is James Davis. I'm a security researcher at Virginia Tech.
The python core (cpython) has 2 regular expressions vulnerable to catastrophic
backtracking that look like potential DOS vectors.
The vulnerable expression
New submission from James Davis :
The decoder regex used to parse numbers in the fpformat module is vulnerable to
catastrophic backtracking.
'^([-+]?)0*(\d*)((?:\.\d*)?)(([eE][-+]?\d+)?)$'
The substructure '0*(\d*)' is quadratic.
An attack string like '+0000++
Change by James Davis :
--
keywords: +patch
pull_requests: +5750
stage: -> patch review
___
Python tracker
<https://bugs.python.org/issue32997>
___
___
Python-
James Davis added the comment:
Equivalent, probably cleaner. Comment on the PR if you want a change.
--
___
Python tracker
<https://bugs.python.org/issue32