php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #43011 positive lookbehind causing seg fault with preg_match_all
Submitted: 2007-10-17 23:58 UTC Modified: 2007-10-22 08:49 UTC
Votes:1
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: sjungwirth at matrix-consultants dot com Assigned:
Status: Closed Package: Reproducible crash
PHP Version: 5.2.4 OS: Linux 2.4.21
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: sjungwirth at matrix-consultants dot com
New email:
PHP Version: OS:

 

 [2007-10-17 23:58 UTC] sjungwirth at matrix-consultants dot com
Description:
------------
positive lookbehind is causing seg fault in preg_match_all, If i take out the positive lookbehind, it doesn't crash.

Reproduce code:
---------------
<?php
echo "starting\n";
$subject = "enum('active','inactive','rockin\'')";
$pattern = "/'(([^']*((?<=\\\\)')?)*)'/";
preg_match_all($pattern,$subject ,$matches);
print_r($matches);
echo "done.";

Expected result:
----------------
starting
Array
(
    [0] => Array
        (
            [0] => 'active'
            [1] => 'inactive'
            [2] => 'rockin\''
        )

    [1] => Array
        (
            [0] => active
            [1] => inactive
            [2] => rockin\'
        )

    [2] => Array
        (
            [0] => 
            [1] => 
            [2] => 
        )

    [3] => Array
        (
            [0] => 
            [1] => 
            [2] => '
        )

)
done.

Actual result:
--------------
starting
Segmentation fault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-10-18 00:38 UTC] felipensp at gmail dot com
It's works with the newer version in CVS.
 [2007-10-22 08:49 UTC] jani@php.net
Fixed in CVS.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Tue Jul 15 01:01:35 2025 UTC