Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flask_util.RegexConverter hangs on werkzeug 2.2.0 with some regexps #8

Closed
snarfed opened this issue Aug 3, 2022 · 2 comments
Closed

Comments

@snarfed
Copy link
Owner

snarfed commented Aug 3, 2022

Example: ([^/:]+\.[^/:]+)

Repro:

app = Flask(__name__)
app.url_map.converters['regex'] = flask_util.RegexConverter
app.add_url_rule(r'/acct:<regex("([^/:]+\.[^/:]+)"):foo>', view_func=lambda: 'foo')

Pegs the CPU at 100%, probably an infinite loop in werkzeug 2.2.0's new router, pallets/werkzeug#2433 . It gets stuck parsing the rule, eg:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File ".../flask/scaffold.py", line 56, in wrapper_func
    return f(self, *args, **kwargs)
  File ".../flask/app.py", line 1086, in add_url_rule
    self.url_map.add(rule)
  File ".../werkzeug/routing/map.py", line 174, in add
    rule.bind(self)
  File ".../werkzeug/routing/rules.py", line 554, in bind
    self.compile()
  File ".../werkzeug/routing/rules.py", line 655, in compile
    self._parts.extend(self._parse_rule(rule))
  File ".../werkzeug/routing/rules.py", line 590, in _parse_rule
    match = _part_re.match(rule, pos, endpos)
@snarfed
Copy link
Owner Author

snarfed commented Aug 3, 2022

Maybe related: pallets/werkzeug#2481

@snarfed
Copy link
Owner Author

snarfed commented Dec 1, 2022

They fixed it: pallets/werkzeug#2481 (comment)

@snarfed snarfed closed this as completed Dec 1, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant