php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #61644 crashes with preg_match
Submitted: 2012-04-05 21:31 UTC Modified: 2012-04-06 16:05 UTC
From: pio at rdl dot pl Assigned:
Status: Not a bug Package: Regexps related
PHP Version: 5.3.10 OS: Debian 6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: pio at rdl dot pl
New email:
PHP Version: OS:

 

 [2012-04-05 21:31 UTC] pio at rdl dot pl
Description:
------------
Hello !
We have problem with parse some data and regular expression match.

I have attached the file 1.txt

# /usr/local/php5.3/bin/php test.php
Segmentation fault




(gdb) run test.php
Starting program: /usr/local/bin/php test.php
[Thread debugging using libthread_db enabled]
[New Thread 0x7f1659abb710 (LWP 14776)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f1659abb710 (LWP 14776)]
0x00000000004bf9ff in match (
    eptr=0x1632378 "nteria.pl;;\nmaciej--m@o2.pl;;\nmaciej.lenart@lumenpolska.pl;;\nmaciej@szerszenowicz.com;;\nmaciej_zieba@op.pl;;\nmaciekprokopowicz@gmail.com;;\nmadziamika@tlen.pl;;\nmadziorekk@wp.pl;;\nmagda.mackiewicz@o2.p"..., ecode=0x165916a "V",
    mstart=0x1630b08 "status=OK\nsubscribers-exported=150294@student.pwr.wroc.pl;;\n2tom2@gazeta.pl;;\n70iza@interia.pl;;\n73piotras@wp.pl;;\na.galecka@zarzadca.wroclaw.pl;;\na.grod@poczta.fm;;\na.gruszewska@gmail.com;;\na.karamon"..., markptr=0x0, offset_top=8, md=0x7fff797e7960, ims=0, eptrb=0x0, flags=0,
    rdepth=12461) at /usr/local/directadmin/custombuild/php-5.2.17/ext/pcre/pcrelib/pcre_exec.c:1552
1552    /usr/local/directadmin/custombuild/php-5.2.17/ext/pcre/pcrelib/pcre_exec.c: No such file or directory.
        in /usr/local/directadmin/custombuild/php-5.2.17/ext/pcre/pcrelib/pcre_exec.c
(gdb) print (char *)(executor_globals.function_state_ptr->function)->common.function_name
$1 = 0x89f727 "preg_match"


regards,
Piotr


Test script:
---------------
<?php

$matches = array();
$data = file_get_contents('1.txt');
var_dump(preg_match('/^(.|\s)+?subscribers-exported=((.|\s)+)$/', $data, $matches));


Expected result:
----------------
int(0)


Actual result:
--------------
crash

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-04-05 21:34 UTC] pio at rdl dot pl
The file 1.txt here is

http://speedy.sh/YGJDR/1.txt
 [2012-04-06 03:37 UTC] laruence@php.net
http://speedy.sh/YGJDR/1.txt 404 for me...
 [2012-04-06 15:44 UTC] pio at rdl dot pl
OK,I have uploaded this file on server

http://s71.vdl.pl/1.txt

Piotr
 [2012-04-06 16:05 UTC] pajoye@php.net
Increase the recursion limit or your stack size:

http://php.net/manual/en/pcre.configuration.php
 [2012-04-06 16:05 UTC] pajoye@php.net
-Status: Open +Status: Not a bug
 
PHP Copyright © 2001-2022 The PHP Group
All rights reserved.
Last updated: Thu May 19 19:04:05 2022 UTC