Skip to content

Keep the RFC 2396 regexps within the match cache - #271

Open
mame wants to merge 1 commit into
ruby:masterfrom
mame:uri-linear-regexp
Open

mame wants to merge 1 commit into
ruby:masterfrom
mame:uri-linear-regexp

Conversation

@mame

@mame mame commented Nov 17, 2026

Copy link
Copy Markdown
Member

The bounded repeats {2}, {1,3} and {1,4} inside other repeats keep the regexp match cache from being used, and URI.extract and URI.regexp took quadratic time on some inputs. Spell them out with optional atoms so that the regexps satisfy Regexp.linear_time?.

Reported-by: Bilal Karaaslan (https://hackerone.com/bilalkaraaslan)

The bounded repeats {2}, {1,3} and {1,4} inside other repeats keep the
regexp match cache from being used, and URI.extract and URI.regexp took
quadratic time on some inputs.  Spell them out with optional atoms so
that the regexps satisfy Regexp.linear_time?.

Reported-by: Bilal Karaaslan (https://hackerone.com/bilalkaraaslan)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@mame
mame requested a review from nobu November 17, 2026 04:40

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

1 participant

⌂ Proxy