#44229 [Opn->Bgs]: Too many subpattern matches cause segfault
| From: | felipe@php.net | Date: | Sat, 23 Feb 2008 23:46:54 +0000 |
| Subject: | #44229 [Opn->Bgs]: Too many subpattern matches cause segfault | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-122616@lists.php.net to get a copy of this message | ||
ID: 44229
Updated by: felipe@php.net
Reported By: martin dot kevin at gmail dot com
-Status: Open
+Status: Bogus
Bug Type: PCRE related
Operating System: Debian
PHP Version: 5.2CVS-2008-02-23 (snap)
New Comment:
See:
Bug#33468
Bug#39387
Previous Comments:
------------------------------------------------------------------------
[2008-02-23 22:52:38] martin dot kevin at gmail dot com
Description:
------------
Matching a string against a pattern that will have many subpattern
matches causes a segmentation fault.
Reproduce code:
---------------
#!/usr/bin/env php
<?php
$testPattern = <<< EOS
/([^"])+/
EOS;
$testString = '"';
for ( $count = 0; $count < 1030; $count++ )
$testString .= '\x90';
for ( $count = 1030; $count < 4000; $count++ )
{
$testString .= '\x90';
echo "$count\n";
preg_match ( $testPattern, $testString . '"', $matches );
}
exit ( 0 );
?>
Expected result:
----------------
Over 1000 matches:
[...]
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
Actual result:
--------------
Segmentation fault at either 1037 or 1038:
1030
1031
1032
1033
1034
1035
1036
1037
1038
Segmentation fault
Note that this seems to vary where it fails; either after 1037 matches
or 1038 matches.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=44229&edit=1