Fix the email regexp CPU usage for odd inputs #36

Merged
merged 1 commit into from Oct 22, 2013

Conversation

Projects
None yet
4 participants
@mitio
Contributor

mitio commented Oct 22, 2013

Fixes #34

Some inputs could make the regexp engine in Ruby take up a lot of CPU time in order to check for a match of an email in the input string. This change adds a test to guard against an example of such an input and changes the email regexp so that all the tests pass and so that no excessive CPU usage occurs.

The new email regexp is based on the changes suggested by @andresbravog in #34 but is changed a bit so that tests pass.

Fix the email regexp CPU usage for odd inputs
Fixes #34

Some inputs could make the Regexp engine in Ruby to take up a lot of
CPU time in order to check for a match of the email string. This change
adds a test to guard against an example of such an input and changes
the email regexp so that all the tests pass and so that no excessive
CPU usage occurs.
@andresbravog

This comment has been minimized.

Show comment Hide comment
@andresbravog

andresbravog Oct 22, 2013

Contributor

👍

Contributor

andresbravog commented Oct 22, 2013

👍

xuanxu added a commit that referenced this pull request Oct 22, 2013

Merge pull request #36 from mitio/fix-greedy-email-regexp
Fix the email regexp CPU usage for odd inputs

@xuanxu xuanxu merged commit 33193b8 into tenderlove:master Oct 22, 2013

@mitio mitio deleted the mitio:fix-greedy-email-regexp branch Oct 22, 2013

@ktdreyer

This comment has been minimized.

Show comment Hide comment
@ktdreyer

ktdreyer Nov 7, 2013

Contributor

Please see also #40 for a fix when running the tests outside of Rake or Bundler.

Contributor

ktdreyer commented Nov 7, 2013

Please see also #40 for a fix when running the tests outside of Rake or Bundler.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment