ID: 45224 Updated by: [EMAIL PROTECTED] Reported By: dave at westphila dot net -Status: Open +Status: Bogus Bug Type: Reproducible crash Operating System: Linux, Fedora Core 8 PHP Version: 5.2.6 New Comment:
See Bug#33468, Bug#39387 Previous Comments: ------------------------------------------------------------------------ [2008-06-10 00:22:24] dave at westphila dot net Description: ------------ I can reproduce a segfault in a preg_match call with a particular regular expression and target text (which is a large html file). The offending regEx and a very similar one which does not segfault are included in the script I've attached. Reproduce code: --------------- <?php $text = file_get_contents($argv[1]); //$text = "A test string....sdflsmdfs;ldfkgns;dklfjgnsdlkfjgns;df'adslfm,qr;ijgaldsfknvsdl,fbnwle;frnsdlkfjnsldkfjnvsdlkfjnbsldkfjnsldkfjgnsldkfjgnslkdfjgnsdffls dflkgdf;lkgwndf;lkgnsdfkjngsfmn,sdfgsbndflkgjsbdflgkjsdbfglkjsdnfglksjdfnglksdjfnglsdkfjg"; $exp1 = "/(<[^>^<]{1,20}>){0,1}(\s|<[^<^>]+>| )+L(<[^>^<]{1,20}>){0,1}imitation(\s|<[^<^>]+>| )+/"; $exp2 = "/(<[^>^<]{1,20}>){0,1}(\s|<[^<^>]+>| )+L(<[^>^<]{1,20}>){0,1}imitation(\s|<[^<^>]+>| )+o/"; preg_match($exp1, $text); echo "Passed Expression 1\n"; preg_match($exp2, $text); echo "Passed Expression 2\n"; ?> Expected result: ---------------- The file may or may not match the regEx, out of memory maybe, but certainly it shouldn't segfault. Actual result: -------------- The reg ex string in $exp1 runs ok. The expression in $exp2 is only one character longer and produces a segfault when run on the file publicly available here: http://dev.xtractresearch.com/SD11212006CA.htm A segfault does not happen when instead of this file a shorter string of text is used (commented out in the script code). Length of the file should not be an issue since the first regEx completes ok. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=45224&edit=1