Date: Mon, 25 Mar 2013 15:34:52 GMT From: Tamás Kovács <turbopracct@hushmail.com> To: freebsd-gnats-submit@FreeBSD.org Subject: ports/177375: lang/php5 segmentation fault executing pcre (PHP 5.4 preg_replace) Message-ID: <201303251534.r2PFYqA3035490@red.freebsd.org> Resent-Message-ID: <201303251540.r2PFe0Dp061324@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 177375 >Category: ports >Synopsis: lang/php5 segmentation fault executing pcre (PHP 5.4 preg_replace) >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Mar 25 15:40:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Tamás Kovács >Release: FreeBSD 8.3-RELEASE-p3 >Organization: >Environment: FreeBSD freebsd.local 8.3-RELEASE-p3 FreeBSD 8.3-RELEASE-p3 #0: Tue Jun 12 00:39:29 UTC 2012 root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC amd64 >Description: Executing the provided code using PHP 5.4 produces a segmentation fault (core dumped). PHP v5.3 executes the code correctly. PHP v5.4 binary for Windows executes the code correctly. PHP v5.4 from ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/ or compiled from lang/php5 fails with a segmentation fault. This issue has been tested in FreeBSD 8.3-RELEASE and 9.1-RELEASE. gdb indicates that the issue is related to libpcre: Program terminated with signal 11, Segmentation fault. #0 0x0000000800d5ab5d in match () from /usr/local/lib/libpcre.so.3 >How-To-Repeat: Create a file with the following php code and execute from the command line: # php -n ./test.php [php] $code = '<!--' . str_repeat('x', 5438) . '-->'; $result = preg_replace('/(<!--)(?!\s*(?:\[if [^\]]+]|<!|>))((?:(?!-->).)*[^\]])(-->)/is', '', $code); echo strlen($result); [/php] Expected result: 0 Actual result: Segmentation fault (core dumped) Note: Change the value of str_repeat from 5438 to 5437 and no segmentation fault occurs. >Fix: >Release-Note: >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201303251534.r2PFYqA3035490>