#28875 [Opn->Fbk]: Wrong regex crashes server
| From: | sniper@php.net | Date: | Tue, 06 Jul 2004 13:58:09 +0000 |
| Subject: | #28875 [Opn->Fbk]: Wrong regex crashes server | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-61789@lists.php.net to get a copy of this message | ||
ID: 28875
Updated by: sniper@php.net
Reported By: amoljak at cox dot net
-Status: Open
+Status: Feedback
-Bug Type: Reproducible crash
+Bug Type: PCRE related
Operating System: Windows 2000 Server
PHP Version: 4.3.8-dev
New Comment:
What's the difference in the 3rd server to the 2 others..?
And are you aware that PCRE has certain limitations what it can handle
and what not?
Previous Comments:
------------------------------------------------------------------------
[2004-06-22 18:06:38] amoljak at cox dot net
Ok.. It crashes on two servers
And on the third machine it gives the following warning:
Warning: Compilation failed: internal error: code overflow at offset 72
in C:\work\servers\Apache2\htdocs\test\PHP\crashtest.php on line 7
(line 7 is the preg_match thing)
But it does not crash. The php.ini options are the same.
Thanks,
Amol
------------------------------------------------------------------------
[2004-06-22 01:24:34] amoljak at cox dot net
I tried PHP 4.3.8-dev and it is not crashing. So I am closing the bug.
I will reopen if it occures on the machine I initially tried.
Thanks
------------------------------------------------------------------------
[2004-06-22 00:45:31] iliaa@php.net
Please try using this CVS snapshot:
http://snaps.php.net/php4-STABLE-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php4-win32-STABLE-latest.zip
------------------------------------------------------------------------
[2004-06-21 22:58:29] amoljak at cox dot net
Description:
------------
Note the extra ] in the regex. Try to load this page three times and it
will crash the third time.
Reproduce code:
---------------
<?php
$filecontent = "my name is amol";
$regex = "/(^|[^a-zA-Z0-9-])([Nn]on[-s? []]]degrees?
[Ss]tudents?)([^a-zA-Z0-9-]|$)/es";
//preg_match_all($regex, $filecontent , $matches,
PREG_OFFSET_CAPTURE);
preg_match($regex, $filecontent , $matches, PREG_OFFSET_CAPTURE);
print "matches = $matches<br>";
?>
Expected result:
----------------
This is from end user's code and I don't know what he expected. But he
was able to crash the server... thats bad.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=28875&edit=1