|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-23 23:46 UTC] felipe@php.net
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 17:00:01 2025 UTC |
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.