php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #62876 Stack Overflow on preg_replace
Submitted: 2012-08-20 21:04 UTC Modified: 2012-08-20 22:34 UTC
From: lart2150 at gmail dot com Assigned:
Status: Not a bug Package: PCRE related
PHP Version: Irrelevant OS: Windows/Linux/OSX
Private report: No CVE-ID: None
 [2012-08-20 21:04 UTC] lart2150 at gmail dot com
Description:
------------
When I run the test script php crashes.  I have this issue with cli 5.3.10, 5.3.16, and the 5.4 snapshot from the 15th on windows(I can't find a newer snapshot for windows).  I have also reproduced this under mod_php and cli builds from zend server and from apple stock 10.7.

Test script:
---------------
<?php
$sql = "SELECT count(*) AS `count`, GROUP_CONCAT(error_log_id) AS `ids` FROM `error_log` WHERE (error_log_date BETWEEN DATE_SUB(NOW(), INTERVAL '15' MINUTE) AND NOW()) AND (error_log_msg_short = 'Cannot retrieve metadata for IdP \'http://10.246.220.59/saml2/idp/metadata.php\' because it isn\'t a valid IdP for this SP.') AND (error_log_request = 'array (\n  \'controller\' =&gt; \'saml\',\n  \'action\' =&gt; \'acs\',\n  \'source\' =&gt; \'optumsaml\',\n  \'module\' =&gt; \'default\',\n  \'SAMLResponse\' =&gt; \'+PHNhbWw6SXNzdWVyPmh0dHA6Ly8xMC4yNDYuMjIwLjU5L3NhbWwyL2lkcC9tZXRhZGF0YS5waHA8L3NhbWw6SXNzdWVyPjxkczpTaWduYXR1cmUgeG1sbnM6ZHM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvMDkveG1sZHNpZyMiPgogIDxkczpTaWduZWRJbmZvPjxkczpDYW5vbmljYWxpemF0aW9uTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMS8xMC94bWwtZXhjLWMxNG4jIi8+CiAgICA8ZHM6U2lnbmF0dXJlTWV0aG9kIEFsZ29yaXRobT0iaHR0cDovL3d3dy53My5vcmcvMjAwMC8wOS94bWxkc2lnI3JzYS1zaGExIi8+CiAgPGRzO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dWUgeHNpOnR5cGU9InhzOnN0cmluZyI+MTk1MS0wMS0xNjwvc2FtbDpBdHRyaWJ1dGVWYWx1ZT48L3NhbWw6QXR0cmlidXRlPjxzYW1sOkF0dHJpYnV0ZSBOYW1lPSJFbXBsb3llZUlEIiBOYW1lRm9ybWF0PSJ1cm46b2FzaXM6bmFtZXM6dGM6U0FNTDoyLjA6YXR0cm5hbWUtZm9ybWF0OnVyaSI+PHNhbWw6QXR0cmlidXRlVmFsdWUgeHNpOnR5cGU9InhzOnN0cmluZyI+\',\n)') LIMIT 1";
$match = "/'(\'|\\{2}|[^'])*'/";
$sql = preg_replace($match, '', $sql);



Expected result:
----------------
I expect php to return with out any output or crashing.

Actual result:
--------------
segmentation fault I'm including the backtrack from windows(stack overflow).
raw mht is at http://files.bengert.xanthos.soliantconsulting.com/CrashHang_Report__Date_08_20_2012__Time_03_28_13PM__753.mht

PHP5!MATCH+29In php__PID__9988__Date__08_20_2012__Time_03_27_35PM__616__Second_Chance_Exception_C00000FD.dmp the assembly instruction at php5!match+29 in c:\php-5.4-snapshot\php5.dll from The PHP Group has caused a stack overflow exception (0xC00000FD) when trying to write to memory location 0x00aa2f44 on thread 0


Image Name: c:\php-5.4-snapshot\php5.dll   
Symbol Type:  PDB 
Base address: 0x00905a4d   
Time Stamp:  Tue Aug 14 18:41:14 2012  
Checksum: 0x00000000   
Comments:   
COM DLL: False   
Company Name:  The PHP Group 
ISAPIExtension: False   
File Description:  PHP Script Interpreter 
ISAPIFilter: False   
File Version:  5.4.5-dev 
Managed DLL: False   
Internal Name:  PHP Script Interpreter 
VB DLL: False   
Legal Copyright:  Copyright © 1997-2010 The PHP Group 
Loaded Image Name:  php5.dll   
Legal Trademarks:  PHP 
Mapped Image Name:     
Original filename:  php5.dll 
Module name:  php5   
Private Build:   
Single Threaded:  False   
Product Name:  PHP 
Module Size:  5.79 MBytes   
Product Version:  5.4.5-dev 
Symbol File Name:  c:\php-5.4-snapshot\php5.pdb   
Special Build:  & 


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2012-08-20 21:39 UTC] lart2150 at gmail dot com
This might be a issue with one of the more recent changes to php as http://3v4l.org/3cm5f shows that with a smaller string for $sql (wont let me use the full thing) php crashes for "5.3.10 - 5.3.16, 5.4.1 - 5.4.6" but works fine for "4.3.0 - 4.3.11, 4.4.0 - 4.4.9, 5.0.0 - 5.0.5, 5.1.0 - 5.1.6, 5.2.0 - 5.2.17, 5.3.0 - 5.3.9, 5.4.0"
 [2012-08-20 22:17 UTC] jbury at soliantconsulting dot com
I think this might be a case of a pathological regular expression.  I tried 
converting the grouping parentheses to non-grouping, and it seems to have helped 
the regular expression complete matching on later versions of PHP, although it 
still fails on some older versions.

<?php

$sql = "'" . str_repeat('a', 10*1024);
$match = "/'(\'|\\{2}|[^'])*'/";
$sql = preg_replace($match, '', $sql);
var_dump($sql);
 [2012-08-20 22:21 UTC] jbury at soliantconsulting dot com
This version with non-grouping parentheses works on later versions of PHP:

<?php

$sql = "'" . str_repeat('a', 10*1024);
$match = "/'(?:\'|\\{2}|[^'])*'/";
$sql = preg_replace($match, '', $sql);
var_dump($sql);
 [2012-08-20 22:34 UTC] felipe@php.net
-Status: Open +Status: Not a bug
 [2012-08-20 22:34 UTC] felipe@php.net
Stack overflow related to PCRE are known issues, it isn't a PHP issue.

Thanks.
 [2012-08-20 22:34 UTC] felipe@php.net
-Package: Regexps related +Package: PCRE related
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 12:01:31 2024 UTC