php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #39934 pcre simple segfault ?
Submitted: 2006-12-22 20:35 UTC Modified: 2006-12-22 22:22 UTC
From: toggg@php.net Assigned:
Status: Not a bug Package: PCRE related
PHP Version: 4.4.4 OS: Irrelevant
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: toggg@php.net
New email:
PHP Version: OS:

 

 [2006-12-22 20:35 UTC] 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";
?>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-12-22 21:42 UTC] tony2001@php.net
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
 [2006-12-22 22:12 UTC] toggg@php.net
Thanks,
That was the expected answer, just wanted to report back to primary pear user.
So, you mean we cannot use pcre, does give an alternative ?
Or is the bug to push in another location ?
 [2006-12-22 22:22 UTC] tony2001@php.net
>So, you mean we cannot use pcre, does give an alternative ?
I don't get the question, sorry.

>Or is the bug to push in another location ?
To PCRE developers, probably?
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 21 00:01:27 2024 UTC