#40706 [Opn->Bgs]: preg_match crash

From: Date: Mon, 05 Mar 2007 09:58:19 +0000
Subject: #40706 [Opn->Bgs]: preg_match crash
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-109895@lists.php.net to get a copy of this message
ID: 40706 Updated by: tony2001@php.net Reported By: askold2 at velo dot nsk dot ru -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: any PHP Version: 4.4.6 New Comment: We can't fix PCRE stack overflow (it's not PHP problem anyway), but we have a workaround for it in PHP5. Please consider upgrading. Previous Comments: ------------------------------------------------------------------------ [2007-03-04 13:47:46] bmihelac at mihelac dot org I have similiar problem both on linux and windows. On windows it crashes PHP without any error notices. I am not sure if it crash PHP on linux/unix. Seems that regex with nested parenthesizes are especially vunerable, for example: $pattern = '/"([^"\\\\]*(?:(?:\\\\.)*[^"\\\\]*)*)"/'; ------------------------------------------------------------------------ [2007-03-03 15:12:45] askold2 at velo dot nsk dot ru Description: ------------ the regular expression like ((any text)*(other text)*)* produce the hang or crash of PHP program. In the previous versions of php all worked properly. Reproduce code: --------------- $subj="sdfgsdg"; if(preg_match('/^((a)*(b)*)*$/',$subj)) echo "match"; else echo "not match"; Expected result: ---------------- "match" or "not match" printing Actual result: -------------- nothing. the hung of script on my unux hosting and breaking program in windows ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40706&edit=1

« previous php.bugs (#109895) next »