[issue30148] Pathological regex behaviour

Matthew Barnett report at bugs.python.org
Sun Apr 23 16:04:05 EDT 2017


Matthew Barnett added the comment:

If 'ignores' is '', you get this:

    (?:\b(?:extern|G_INLINE_FUNC|%s)\s*)

which can match an empty string, and it's tried repeatedly.

That's inadvisable.

There's also:

    (?:\s+|\*)+

which can match whitespace in multiple ways.

That's inadvisable too.

If the pattern really doesn't match the string (and it doesn't!), then it won't find out until it has tried _all_ of the possibilities.

Some implementations, such as Perl's, have extra checks to try to reduce the problem.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30148>
_______________________________________


More information about the Python-bugs-list mailing list