#41448 [Com]: segmentation fault

From: Date: Mon, 21 May 2007 01:08:17 +0000
Subject: #41448 [Com]: segmentation fault
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-112885@lists.php.net to get a copy of this message
ID: 41448 Comment by: judas dot iscariote at gmail dot com Reported By: whitephoenix at mail dot ru Status: Feedback Bug Type: PCRE related Operating System: CentOS 4.3 64-Bit PHP Version: 5.2.2 New Comment: PCRE crashes on match(), with either the bundled version or with latest 7.1. does not crash with 6.7. this is reproducible in both 32 and 64 bit here, so you dont need a 64 bit machine to get a backtrace ;-) Previous Comments: ------------------------------------------------------------------------ [2007-05-20 10:19:06] nlopess@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. I don't have access to a 64-bit machine, so I need the backtrace to take a look. ------------------------------------------------------------------------ [2007-05-20 08:22:49] whitephoenix at mail dot ru Description: ------------ The following source gives segfault on CentOS 4.3 64-Bit and PHP 5.2.2. Don't be scared, this regular expression is real parser for my templates-engine, and it works with other operation systems. The result depends on Subject, so with '$var' it works well, but if '$var[anything]' then crashes. Reproduce code: --------------- <?php echo 'proof of compilation'."\n"; preg_replace( '~(([\'"]).*?(?<!\\\\)\2|\w*\s*\(((?:(?R)|.)*?)\)' .'|[\$#]\w+#?(?:\\[(?:(?R)|((?:[^\\]\'"]*(?:([\'"]).*?(?<!\\\\)\5)?)*))*?\\]|\.[\$#]?\w+#?|->\s*[\$#]?\w+(?:\(((?:(?R)|.)*?)\))?)*' .'|-?\d+|(?<=^|[\s\)\:\.=+\-<>])(?:\w+)(?=$|[\s\|\.\:\(=+\-<>]))(\s+(?:is(?:\s+not)?\s+(?:odd|div|even)\s+by\s+-?\d+|is(?:\s+not)?\s+(?:odd|even)))?((?:\|@?\w+(?:\\:(?:'.'\w*\(((?:(?R)|.)*?)\)|[\$#]\w+#?(?:\\[(?:(?R)|((?:[^\\]\'"]*(?:([\'"]).*?(?<!\\\\)\11)?)*))*?\\]|\.[\$#]?\w+#?)*|[^\'"\:]*(?:[^\'"\:]*([\'"]).*?(?<!\\\\)\12[^\'"\:]*)*'.'))*)*)' .'|((?<=\s|\))(?:is\s+not|is|not\s+eq|eq|neq?|gt|lt|gt?e|ge|lt?e|mod)(?=\s|\()|(?:not\s+))' .'~si','any replacement','$var[index]'); Expected result: ---------------- "any replacement" Actual result: -------------- [root@72 _test]# php -q bug.php proof of compilation Segmentation fault ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=41448&edit=1

« previous php.bugs (#112885) next »