#39934 [Opn->Bgs]: pcre simple segfault ?

From: Date: Fri, 22 Dec 2006 21:42:50 +0000
Subject: #39934 [Opn->Bgs]: pcre simple segfault ?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-106807@lists.php.net to get a copy of this message
ID: 39934 Updated by: tony2001@php.net Reported By: toggg@php.net -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Irrelevant PHP Version: 4.4.4 New Comment: Stack overflow in PCRE has been reported many times and is not really a problem in PHP, though newer PHP versions (5.2.0+) have a workaround for this problem. See pcre.backtrack_limit @ http://php.net/pcre Previous Comments: ------------------------------------------------------------------------ [2006-12-22 20:35:40] toggg@php.net Description: ------------ It is a reduction of http://pear.php.net/bugs/bug.php?id=7908 This test is breaking by repeat=437 by php-4.4.4 Windows NT and 10000 by php 5.1.6 linux FC5 It's not breaking if you give ok=1 or nomatch=1 or reduce enough repeat. Note: it's php version irrelevent , but your sytem forced to choose some. Reproduce code: --------------- <?php error_reporting(E_ALL); ini_set('display_errors', true); function process($matches) { return $matches[0]; } $regex = isset($_GET['ok']) ? '#X(.*?)X#' : '#X((.)*?)X#'; $around = isset($_GET['nomatch']) ? 'Y' : 'X'; $repeat = isset($_GET['repeat']) ? (int) $_GET['repeat'] : 10000; $source = $around . str_repeat('a', $repeat) . $around; $transform = preg_replace_callback($regex, 'process', $source); echo '---Text---' . strlen($source) . "\n"; echo "---Transform---" . strlen($transform) . "\n"; ?> ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=39934&edit=1

« previous php.bugs (#106807) next »