bug-gnu-utils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Regex Hangs


From: Khamis Siksek
Subject: Regex Hangs
Date: Sat, 28 Dec 2002 19:57:56 +0200

Just a small clarification,

I just wanted to clarify something that it isn't the equal sign that causes the 
problem by it self, but if the string doesn't match the regular expression, and 
in my case the equal sign causes that, if you use ( instead of equal sign you 
will have the same behavior ...

Dear Sir,

I think I found a bug in the Regex library 0.12 (glibc version 1.2.10 on RedHat 
7.2), I would like to explain the situation and what happened with me ...

I am using regex in validating email addresses for a certain project I am 
working on, what I faced is when the email address contains = sign, and the 
string is a little bit long the regexec hangs and doesn't return, I shortened 
the string 3 or 4 characters, regexec returned after taking long time 
processing the string against my regular expression, and not to leave things 
confusing to you, I wrote a small (and very simple) code to test the regex, and 
the bug is reproducible using it. (compile using gcc -Wall TestReg.c).
and try the following strings:
address@hidden

try increasing the number of d's (at the beginning of the string) by two and 
notice the difference in time it takes between every one test and another,

It is going to hang when the number of d's exceeds 22 (or 24) (actually the 
string length exceeds 56).

If you remove the equal (=) sign, everything returns to normal, and the string 
length can go up to 128 (or even more).

So do anyone have an explanation for what is happening or a fix for the bug, I 
am now looking at the source of regex trying to find a fix from my end, but 
maybe someone better can get it faster ...


 <<TestReg.c>> 

NOTE: please when replying use my email address also ...

Thanks and best regards,

Khamis Samir Al-Siksek
Mobile  +962 79 5554986

Attachment: TestReg.c
Description: TestReg.c


reply via email to

[Prev in Thread] Current Thread [Next in Thread]