#38600 [NEW]: Infinite loop in preg_match
| From: | phillip dot berndt at googlemail dot com | Date: | Fri, 25 Aug 2006 21:14:47 +0000 |
| Subject: | #38600 [NEW]: Infinite loop in preg_match | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-101348@lists.php.net to get a copy of this message | ||
From: phillip dot berndt at googlemail dot com
Operating system: Linux
PHP version: 5.1.5
PHP Bug Type: PCRE related
Bug description: Infinite loop in preg_match
Description:
------------
When executing the code below, the function won't return but loop forever
(or do something else, I don't know).
Reproduce code:
---------------
<?php
$foo = 'bla bla bla';
preg_match('/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/',
$foo);
?>
Expected result:
----------------
Something like that:
pberndt@locutus ~ $ time perl -e '$_="bla bla bla";
/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/;'
real 0m0.017s
user 0m0.016s
sys 0m0.000s
Actual result:
--------------
pberndt@locutus ~ $ php
<?php
set_time_limit(10);
$foo = 'bla bla bla';
preg_match('/(?<!\w)(0x[\p{N}]+[lL]?|[\p{Nd}]+(e[\p{Nd}]*)?[lLdDfF]?)(?!\w)/',
$foo);
?>
Fatal error: Maximum execution time of 10 seconds exceeded in
/home/pberndt/- on line 4
--
Edit bug report at http://bugs.php.net/?id=38600&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=38600&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=38600&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=38600&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=38600&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=38600&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=38600&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=38600&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=38600&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=38600&r=support
Expected behavior: http://bugs.php.net/fix.php?id=38600&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=38600&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=38600&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=38600&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=38600&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=38600&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=38600&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=38600&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=38600&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=38600&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=38600&r=mysqlcfg