Skip to content

Conversation

@ericcornelissen
Copy link

Change the regular expression for matching the function name to avoid potential quadratic runtime of the implementation of Function.prototype.name due to the regular expression in es6-sham.js:157.

I'm not aware of any input that would trigger such behavior, however the fix in this case is trivial. In fact, both the leading \s and trailing \s in the regular expression are unnecessary (though, based on context, I would say the leading \s is actually necessary, however it currently isn't so...).

See also es-shims/Function.prototype.name#37

Change the regular expression for matching the function
name to avoid potential quadratic runtime of the
implementation of `Function.prototype.name` due to the
regular expression in `es6-sham.js:157`.

I'm not aware of any input that would trigger such
behavior, however the fix in this case is trivial. In
fact, both the leading `\s` and trailing `\s` in the
regular expression are unnecessary (though, based on
context, I would say the leading `\s` is actually
necessary, however it currently isn't so...).
@ljharb
Copy link
Collaborator

ljharb commented Nov 16, 2025

If there's no regression test I'm not sure it's worth fixing.

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.

2 participants