Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Email-Address CPAN distribution.

Report information
The Basics
Id: 16320
Status: resolved
Priority: 0/
Queue: Email-Address

People
Owner: Nobody in particular
Requestors: sir_edgar [...] rambler.ru
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: processing address with many white spaces
There are strings that contain many white spaces between addresses, e.g. $value = q{first@foo.org,} . q{ } x 30 . q{second@foo.org}; If we call Email::Address->parse($value); program can hang-up. It seems that execution time grows exponentially with the number of white spaces. Perl version: v5.8.5 built for i386-linux-thread-multi OS: Red Hat Linux 2.4.21
On Tue Dec 06 09:52:38 2005, guest wrote: Show quoted text
> It seems that execution time grows exponentially > with the number of white spaces.
It does, doesn't it? I've put a patch in place in Subversion that cuts the time about in half, but it's still totally unacceptable.
From: PJS [...] cpan.org
Just hit this bug and came here, discovered this ticket. I had a case where parsing an address caused the process to become unkillable short of -9 due to this. Debugging it showed a pathological regex, FWIW: Email::Address::parse(/usr/lib/perl5/site_perl/5.8.5/Email/Address.pm:159): 159: my ($phrase) = /($display_name)/o; DB<9> x $display_name 0 Regexp=SCALAR(0x9990d18) -> qr/(?-xism:(?-xism:(?-xism:(?-xism:(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|)+)*\s*\)\s*))+)*\s*\)\s*)+|\s+)*[^\x00-\x1F\x7F()<>\[\]:;@\,."\s]+(?-xism:(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|)+)*\s*\)\s*))+)*\s*\)\s*)+|\s+)*)|(?-xism:(?-xism:(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|)+)*\s*\)\s*))+)*\s*\)\s*)+|\s+)*"(?-xism:(?-xism:[^\\"])|(?-xism:\\(?-xism:[^\x0A\x0D])))+"(?-xism:(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|(?-xism:\s*\((?:\s*(?-xism:(?-xism:(?>[^()\\]+))|(?-xism:\\(?-xism:[^\x0A\x0D]))|)+)*\s*\)\s*))+)*\s*\)\s*)+|\s+)*))+)/ DB<10> x $phrase 0 undef DB<11> x $_ 0 ' ' DB<12> n Killed My workaround is to s/[ \t]+/ /g first.
Until the regexes are fixed -- which is beyond my current ability to do without painstaking labor -- I have added code to collapse whitespace by default. It can be disabled. -- rjbs