Bug #73769 [NEW]: Segfault in preg_match_all
| From: | mozer624 at gmail dot com | Date: | Sat, 17 Dec 2016 02:28:56 +0000 |
| Subject: | Bug #73769 [NEW]: Segfault in preg_match_all | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206087@lists.php.net to get a copy of this message | ||
From: mozer624 at gmail dot com
Operating system: macOS 10.12
PHP version: 5.6.29
Package: *Regular Expressions
Bug Type: Bug
Bug description:Segfault in preg_match_all
Description:
------------
preg_match_all causes a
Segmentation fault: 11.
Test script:
---------------
<?php
$pattern = "/^(?P<file>.+?):(?P<line>.+?):(?P<char>.+?):
(?P<severity>warning|error): (?P<message>.*)
\[(?P<name>.+?)?\]\n(original=\[\[(?P<original>(.|\n)*?)\]\]\nreplacement=\[\[(?P<replacement>(.|\n)*?)\]\])?/m";
$output = <<<EOT
x/x/x.m:520:-8549: error: Using arrayWithObjects:, use @[] instead
[Array_With_Objects]
original=[[[NSArray arrayWithObjects:
[NSValue
valueWithCGPoint:CGPointMake(1.02, 0.542)],
[NSValue
valueWithCGPoint:CGPointMake(1.73, 0.71)],
[NSValue
valueWithCGPoint:CGPointMake(2.44, 0.708)],
[NSValue
valueWithCGPoint:CGPointMake(3.24, 0.808)],
[NSValue
valueWithCGPoint:CGPointMake(3.71, 0.47)],
[NSValue
valueWithCGPoint:CGPointMake(4.23, 0.514)],
[NSValue
valueWithCGPoint:CGPointMake(4.8, 0.572)],
[NSValue
valueWithCGPoint:CGPointMake(5.3, 0.504)],
[NSValue
valueWithCGPoint:CGPointMake(6.08, 0.776)],
[NSValue
valueWithCGPoint:CGPointMake(6.7, 0.616)],
[NSValue
valueWithCGPoint:CGPointMake(7.23, 0.53)],
[NSValue
valueWithCGPoint:CGPointMake(7.77, 0.542)],
[NSValue
valueWithCGPoint:CGPointMake(8.35, 0.582)],
[NSValue
valueWithCGPoint:CGPointMake(9.01, 0.656)],
[NSValue
valueWithCGPoint:CGPointMake(9.66, 0.658)],
[NSValue
valueWithCGPoint:CGPointMake(10.3, 0.624)],
[NSValue
valueWithCGPoint:CGPointMake(11.2, 0.93)],
[NSValue
valueWithCGPoint:CGPointMake(11.9, 0.65)],
[NSValue
valueWithCGPoint:CGPointMake(12.4, 0.54)],
[NSValue
valueWithCGPoint:CGPointMake(13.1, 0.646)],
[NSValue
valueWithCGPoint:CGPointMake(13.7, 0.678)],
[NSValue
valueWithCGPoint:CGPointMake(14.2, 0.464)],
[NSValue
valueWithCGPoint:CGPointMake(14.8, 0.582)],
[NSValue
valueWithCGPoint:CGPointMake(15.3, 0.486)],
[NSValue
valueWithCGPoint:CGPointMake(15.7, 0.446)],
[NSValue
valueWithCGPoint:CGPointMake(16.4, 0.656)],
[NSValue
valueWithCGPoint:CGPointMake(16.8, 0.472)],
[NSValue
valueWithCGPoint:CGPointMake(17.5, 0.634)],
[NSValue
valueWithCGPoint:CGPointMake(18.0, 0.524)],
[NSValue
valueWithCGPoint:CGPointMake(18.7, 0.742)],
[NSValue
valueWithCGPoint:CGPointMake(19.4, 0.682)],
[NSValue
valueWithCGPoint:CGPointMake(19.9, 0.498)],
[NSValue
valueWithCGPoint:CGPointMake(20.4, 0.528)],
[NSValue
valueWithCGPoint:CGPointMake(21.2, 0.776)],
[NSValue
valueWithCGPoint:CGPointMake(21.7, 0.51)],
[NSValue
valueWithCGPoint:CGPointMake(22.2, 0.464)],
[NSValue
valueWithCGPoint:CGPointMake(22.7, 0.524)],
[NSValue
valueWithCGPoint:CGPointMake(23.3, 0.592)],
[NSValue
valueWithCGPoint:CGPointMake(23.8, 0.536)],
[NSValue
valueWithCGPoint:CGPointMake(24.4, 0.558)],
[NSValue
valueWithCGPoint:CGPointMake(25.2, 0.838)],
[NSValue
valueWithCGPoint:CGPointMake(25.8, 0.556)],
[NSValue
valueWithCGPoint:CGPointMake(26.4, 0.55)],
[NSValue
valueWithCGPoint:CGPointMake(27.0, 0.672)],
[NSValue
valueWithCGPoint:CGPointMake(27.8, 0.766)],
[NSValue
valueWithCGPoint:CGPointMake(28.4, 0.652)],
[NSValue
valueWithCGPoint:CGPointMake(29.1, 0.61)],
[NSValue
valueWithCGPoint:CGPointMake(30.2, 1.19)],
[NSValue
valueWithCGPoint:CGPointMake(30.8, 0.598)],
[NSValue
valueWithCGPoint:CGPointMake(31.5, 0.696)],
[NSValue
valueWithCGPoint:CGPointMake(32.0, 0.428)],
[NSValue
valueWithCGPoint:CGPointMake(32.6, 0.632)],
[NSValue
valueWithCGPoint:CGPointMake(33.4, 0.766)],
[NSValue
valueWithCGPoint:CGPointMake(34.2, 0.838)],
[NSValue
valueWithCGPoint:CGPointMake(34.9, 0.728)],
[NSValue
valueWithCGPoint:CGPointMake(35.5, 0.608)],
[NSValue
valueWithCGPoint:CGPointMake(36.0, 0.44)],
[NSValue
valueWithCGPoint:CGPointMake(36.8, 0.854)],
[NSValue
valueWithCGPoint:CGPointMake(37.3, 0.476)],
[NSValue
valueWithCGPoint:CGPointMake(38.0, 0.686)],
[NSValue
valueWithCGPoint:CGPointMake(38.5, 0.482)],
[NSValue
valueWithCGPoint:CGPointMake(39.0, 0.574)],
[NSValue
valueWithCGPoint:CGPointMake(39.7, 0.664)],
[NSValue
valueWithCGPoint:CGPointMake(40.2, 0.504)],
[NSValue
valueWithCGPoint:CGPointMake(41.1, 0.878)],
[NSValue
valueWithCGPoint:CGPointMake(41.6, 0.552)],
[NSValue
valueWithCGPoint:CGPointMake(42.5, 0.804)],
[NSValue
valueWithCGPoint:CGPointMake(43.0, 0.536)],
[NSValue
valueWithCGPoint:CGPointMake(43.5, 0.486)],
[NSValue
valueWithCGPoint:CGPointMake(44.1, 0.586)],
[NSValue
valueWithCGPoint:CGPointMake(44.6, 0.494)],
[NSValue
valueWithCGPoint:CGPointMake(45.4, 0.892)],
[NSValue
valueWithCGPoint:CGPointMake(46.0, 0.532)],
[NSValue
valueWithCGPoint:CGPointMake(46.5, 0.572)],
[NSValue
valueWithCGPoint:CGPointMake(47.1, 0.592)],
[NSValue
valueWithCGPoint:CGPointMake(47.8, 0.684)],
[NSValue
valueWithCGPoint:CGPointMake(48.4, 0.58)],
[NSValue
valueWithCGPoint:CGPointMake(48.9, 0.474)],
[NSValue
valueWithCGPoint:CGPointMake(49.5, 0.648)],
[NSValue
valueWithCGPoint:CGPointMake(50.1, 0.554)],
[NSValue
valueWithCGPoint:CGPointMake(50.6, 0.476)],
[NSValue
valueWithCGPoint:CGPointMake(51.2, 0.602)],
[NSValue
valueWithCGPoint:CGPointMake(51.8, 0.686)],
[NSValue
valueWithCGPoint:CGPointMake(52.4, 0.6)],
[NSValue
valueWithCGPoint:CGPointMake(53.1, 0.632)],
[NSValue
valueWithCGPoint:CGPointMake(53.6, 0.556)],
[NSValue
valueWithCGPoint:CGPointMake(54.1, 0.514)],
[NSValue
valueWithCGPoint:CGPointMake(54.8, 0.62)],
[NSValue
valueWithCGPoint:CGPointMake(55.3, 0.58)],
[NSValue
valueWithCGPoint:CGPointMake(56.0, 0.642)],
[NSValue
valueWithCGPoint:CGPointMake(56.7, 0.742)],
[NSValue
valueWithCGPoint:CGPointMake(57.5, 0.76)],
[NSValue
valueWithCGPoint:CGPointMake(58.1, 0.57)],
[NSValue
valueWithCGPoint:CGPointMake(58.5, 0.478)],
[NSValue
valueWithCGPoint:CGPointMake(59.2, 0.652)],
[NSValue
valueWithCGPoint:CGPointMake(59.7, 0.558)],
nil]]]
replacement=[[@[
[NSValue
valueWithCGPoint:CGPointMake(1.02, 0.542)],
[NSValue
valueWithCGPoint:CGPointMake(1.73, 0.71)],
[NSValue
valueWithCGPoint:CGPointMake(2.44, 0.708)],
[NSValue
valueWithCGPoint:CGPointMake(3.24, 0.808)],
[NSValue
valueWithCGPoint:CGPointMake(3.71, 0.47)],
[NSValue
valueWithCGPoint:CGPointMake(4.23, 0.514)],
[NSValue
valueWithCGPoint:CGPointMake(4.8, 0.572)],
[NSValue
valueWithCGPoint:CGPointMake(5.3, 0.504)],
[NSValue
valueWithCGPoint:CGPointMake(6.08, 0.776)],
[NSValue
valueWithCGPoint:CGPointMake(6.7, 0.616)],
[NSValue
valueWithCGPoint:CGPointMake(7.23, 0.53)],
[NSValue
valueWithCGPoint:CGPointMake(7.77, 0.542)],
[NSValue
valueWithCGPoint:CGPointMake(8.35, 0.582)],
[NSValue
valueWithCGPoint:CGPointMake(9.01, 0.656)],
[NSValue
valueWithCGPoint:CGPointMake(9.66, 0.658)],
[NSValue
valueWithCGPoint:CGPointMake(10.3, 0.624)],
[NSValue
valueWithCGPoint:CGPointMake(11.2, 0.93)],
[NSValue
valueWithCGPoint:CGPointMake(11.9, 0.65)],
[NSValue
valueWithCGPoint:CGPointMake(12.4, 0.54)],
[NSValue
valueWithCGPoint:CGPointMake(13.1, 0.646)],
[NSValue
valueWithCGPoint:CGPointMake(13.7, 0.678)],
[NSValue
valueWithCGPoint:CGPointMake(14.2, 0.464)],
[NSValue
valueWithCGPoint:CGPointMake(14.8, 0.582)],
[NSValue
valueWithCGPoint:CGPointMake(15.3, 0.486)],
[NSValue
valueWithCGPoint:CGPointMake(15.7, 0.446)],
[NSValue
valueWithCGPoint:CGPointMake(16.4, 0.656)],
[NSValue
valueWithCGPoint:CGPointMake(16.8, 0.472)],
[NSValue
valueWithCGPoint:CGPointMake(17.5, 0.634)],
[NSValue
valueWithCGPoint:CGPointMake(18.0, 0.524)],
[NSValue
valueWithCGPoint:CGPointMake(18.7, 0.742)],
[NSValue
valueWithCGPoint:CGPointMake(19.4, 0.682)],
[NSValue
valueWithCGPoint:CGPointMake(19.9, 0.498)],
[NSValue
valueWithCGPoint:CGPointMake(20.4, 0.528)],
[NSValue
valueWithCGPoint:CGPointMake(21.2, 0.776)],
[NSValue
valueWithCGPoint:CGPointMake(21.7, 0.51)],
[NSValue
valueWithCGPoint:CGPointMake(22.2, 0.464)],
[NSValue
valueWithCGPoint:CGPointMake(22.7, 0.524)],
[NSValue
valueWithCGPoint:CGPointMake(23.3, 0.592)],
[NSValue
valueWithCGPoint:CGPointMake(23.8, 0.536)],
[NSValue
valueWithCGPoint:CGPointMake(24.4, 0.558)],
[NSValue
valueWithCGPoint:CGPointMake(25.2, 0.838)],
[NSValue
valueWithCGPoint:CGPointMake(25.8, 0.556)],
[NSValue
valueWithCGPoint:CGPointMake(26.4, 0.55)],
[NSValue
valueWithCGPoint:CGPointMake(27.0, 0.672)],
[NSValue
valueWithCGPoint:CGPointMake(27.8, 0.766)],
[NSValue
valueWithCGPoint:CGPointMake(28.4, 0.652)],
[NSValue
valueWithCGPoint:CGPointMake(29.1, 0.61)],
[NSValue
valueWithCGPoint:CGPointMake(30.2, 1.19)],
[NSValue
valueWithCGPoint:CGPointMake(30.8, 0.598)],
[NSValue
valueWithCGPoint:CGPointMake(31.5, 0.696)],
[NSValue
valueWithCGPoint:CGPointMake(32.0, 0.428)],
[NSValue
valueWithCGPoint:CGPointMake(32.6, 0.632)],
[NSValue
valueWithCGPoint:CGPointMake(33.4, 0.766)],
[NSValue
valueWithCGPoint:CGPointMake(34.2, 0.838)],
[NSValue
valueWithCGPoint:CGPointMake(34.9, 0.728)],
[NSValue
valueWithCGPoint:CGPointMake(35.5, 0.608)],
[NSValue
valueWithCGPoint:CGPointMake(36.0, 0.44)],
[NSValue
valueWithCGPoint:CGPointMake(36.8, 0.854)],
[NSValue
valueWithCGPoint:CGPointMake(37.3, 0.476)],
[NSValue
valueWithCGPoint:CGPointMake(38.0, 0.686)],
[NSValue
valueWithCGPoint:CGPointMake(38.5, 0.482)],
[NSValue
valueWithCGPoint:CGPointMake(39.0, 0.574)],
[NSValue
valueWithCGPoint:CGPointMake(39.7, 0.664)],
[NSValue
valueWithCGPoint:CGPointMake(40.2, 0.504)],
[NSValue
valueWithCGPoint:CGPointMake(41.1, 0.878)],
[NSValue
valueWithCGPoint:CGPointMake(41.6, 0.552)],
[NSValue
valueWithCGPoint:CGPointMake(42.5, 0.804)],
[NSValue
valueWithCGPoint:CGPointMake(43.0, 0.536)],
[NSValue
valueWithCGPoint:CGPointMake(43.5, 0.486)],
[NSValue
valueWithCGPoint:CGPointMake(44.1, 0.586)],
[NSValue
valueWithCGPoint:CGPointMake(44.6, 0.494)],
[NSValue
valueWithCGPoint:CGPointMake(45.4, 0.892)],
[NSValue
valueWithCGPoint:CGPointMake(46.0, 0.532)],
[NSValue
valueWithCGPoint:CGPointMake(46.5, 0.572)],
[NSValue
valueWithCGPoint:CGPointMake(47.1, 0.592)],
[NSValue
valueWithCGPoint:CGPointMake(47.8, 0.684)],
[NSValue
valueWithCGPoint:CGPointMake(48.4, 0.58)],
[NSValue
valueWithCGPoint:CGPointMake(48.9, 0.474)],
[NSValue
valueWithCGPoint:CGPointMake(49.5, 0.648)],
[NSValue
valueWithCGPoint:CGPointMake(50.1, 0.554)],
[NSValue
valueWithCGPoint:CGPointMake(50.6, 0.476)],
[NSValue
valueWithCGPoint:CGPointMake(51.2, 0.602)],
[NSValue
valueWithCGPoint:CGPointMake(51.8, 0.686)],
[NSValue
valueWithCGPoint:CGPointMake(52.4, 0.6)],
[NSValue
valueWithCGPoint:CGPointMake(53.1, 0.632)],
[NSValue
valueWithCGPoint:CGPointMake(53.6, 0.556)],
[NSValue
valueWithCGPoint:CGPointMake(54.1, 0.514)],
[NSValue
valueWithCGPoint:CGPointMake(54.8, 0.62)],
[NSValue
valueWithCGPoint:CGPointMake(55.3, 0.58)],
[NSValue
valueWithCGPoint:CGPointMake(56.0, 0.642)],
[NSValue
valueWithCGPoint:CGPointMake(56.7, 0.742)],
[NSValue
valueWithCGPoint:CGPointMake(57.5, 0.76)],
[NSValue
valueWithCGPoint:CGPointMake(58.1, 0.57)],
[NSValue
valueWithCGPoint:CGPointMake(58.5, 0.478)],
[NSValue
valueWithCGPoint:CGPointMake(59.2, 0.652)],
[NSValue
valueWithCGPoint:CGPointMake(59.7, 0.558)]]]]
EOT;
$matches = null;
var_dump(preg_match_all($pattern, $output, $matches, PREG_SET_ORDER));
var_dump($matches);
?>
Expected result:
----------------
No seg fault and actually a match with the regex.
--
Edit bug report at https://bugs.php.net/bug.php?id=73769&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73769&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73769&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73769&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73769&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73769&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73769&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73769&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73769&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73769&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73769&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73769&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73769&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73769&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73769&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73769&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73769&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73769&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73769&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73769&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73769&r=mysqlcfg