Bug 177375 - devel/pcre segmentation fault executing match()
Summary: devel/pcre segmentation fault executing match()
Status: Closed Feedback Timeout
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-03-25 15:40 UTC by Tamás Kovács
Modified: 2017-05-24 12:57 UTC (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tamás Kovács 2013-03-25 15:40:00 UTC
Executing the provided code using PHP 5.4 produces a segmentation fault (core dumped).

PHP v5.3 executes the code correctly.
PHP v5.4 binary for Windows executes the code correctly.
PHP v5.4 from ftp.freebsd.org/pub/FreeBSD/ports/amd64/packages-8-stable/Latest/ or compiled from lang/php5 fails with a segmentation fault.

This issue has been tested in FreeBSD 8.3-RELEASE and 9.1-RELEASE.

gdb indicates that the issue is related to libpcre:

Program terminated with signal 11, Segmentation fault.
#0  0x0000000800d5ab5d in match () from /usr/local/lib/libpcre.so.3

How-To-Repeat: Create a file with the following php code and execute from the command line:
# php -n ./test.php

[php]

$code = '<!--' . str_repeat('x', 5438) . '-->';
$result = preg_replace('/(<!--)(?!\s*(?:\[if [^\]]+]|<!|>))((?:(?!-->).)*[^\]])(-->)/is', '', $code);
echo strlen($result);

[/php]


Expected result: 0

Actual result: Segmentation fault (core dumped)

Note: Change the value of str_repeat from 5438 to 5437 and no segmentation fault occurs.
Comment 1 Edwin Groothuis freebsd_committer freebsd_triage 2013-03-25 15:40:07 UTC
Responsible Changed
From-To: freebsd-ports-bugs->ale

Over to maintainer (via the GNATS Auto Assign Tool)
Comment 2 Alex Dupre freebsd_committer freebsd_triage 2013-03-25 15:55:14 UTC
State Changed
From-To: open->closed

Unable to reproduce, probably you have to rebuild pcre.
Comment 3 Alex Dupre freebsd_committer freebsd_triage 2013-03-26 21:38:16 UTC
State Changed
From-To: closed->open

Bug reproduced with pcretest and a 9999 'x's. 


Comment 4 Alex Dupre freebsd_committer freebsd_triage 2013-03-26 21:38:16 UTC
Responsible Changed
From-To: ale->bf

Bug reproduced with pcretest and a 9999 'x's.
Comment 5 Carlo Strub freebsd_committer freebsd_triage 2014-09-11 20:14:07 UTC
Is this PR still relevant?
Comment 6 Rene Ladan freebsd_committer freebsd_triage 2016-06-27 21:50:26 UTC
Maintainer reset.
Comment 7 Eugene Grosbein freebsd_committer freebsd_triage 2017-05-24 12:57:32 UTC
Feedback timeout.