#41050 [Opn->Fbk]: Segmentation fault using preg_match (any PCRE matching)

From: Date: Wed, 11 Apr 2007 11:27:03 +0000
Subject: #41050 [Opn->Fbk]: Segmentation fault using preg_match (any PCRE matching)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-111337@lists.php.net to get a copy of this message
ID: 41050 Updated by: derick@php.net Reported By: legolas558 at users dot sourceforge dot net -Status: Open +Status: Feedback Bug Type: PCRE related Operating System: Windows XP SP2 PHP Version: 4.4.6 New Comment: It's a stack overflow in the pcre library... so how can we fix this? Previous Comments: ------------------------------------------------------------------------ [2007-04-11 11:24:20] legolas558 at users dot sourceforge dot net I have tested with the current v4.4.7 and there is the same problem; I have seen the same bug marked as "bogus" for other OSes since looks like being a PCRE library bug. I have clues that this bug breaks A LOT of different PHP applications ------------------------------------------------------------------------ [2007-04-11 11:19:11] legolas558 at users dot sourceforge dot net Ok, I am going to post the results within a few minutes ------------------------------------------------------------------------ [2007-04-11 11:13:13] derick@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 ------------------------------------------------------------------------ [2007-04-11 10:51:28] legolas558 at users dot sourceforge dot net Description: ------------ I have tested the below script with PHP 4.4.4.4 and there was no problem; now with PHP 4.4.6 there is a crash (probably a segmentation fault) and a server error (500) is returned. I could not provide a win32 backtrace however you can easily generate it using the testcase. Reproduce code: --------------- <?php // by legolas558 $regex = '/(insert|drop|create|select|delete|update)([^;\']*('."('[^']*')+".')?)*(;|$)/i'; $sql = 'SELECT * FROM #__components'; //$sql = ''; // does not cause error if (preg_match($regex,$sql, $m)) echo 'matched'; else echo 'not matched'; ?> Expected result: ---------------- matched Actual result: -------------- CGI Error The specified CGI application misbehaved by not returning a complete set of HTTP headers. The headers it did return are: ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41050&edit=1

« previous php.bugs (#111337) next »