#33640 [Opn->Bgs]: preg_match will cause a segmentation fault on pattern

From: Date: Mon, 11 Jul 2005 07:29:25 +0000
Subject: #33640 [Opn->Bgs]: preg_match will cause a segmentation fault on pattern
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-81660@lists.php.net to get a copy of this message
ID: 33640 Updated by: sniper@php.net Reported By: david dot tulloh at infaze dot com dot au -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: debian linux PHP Version: 5CVS-2005-07-11 (dev) New Comment: You're hitting the PCRE limitations: http://www.pcre.org/pcre.txt Previous Comments: ------------------------------------------------------------------------ [2005-07-11 08:58:41] david dot tulloh at infaze dot com dot au It looks like the segfault actually originates from within libpcre. I'm going to try a newer version. Is there anyway for php to catch the library as it falls over? ------------------------------------------------------------------------ [2005-07-11 08:53:17] david dot tulloh at infaze dot com dot au Description: ------------ While trying to craft a relatively complex regex string I caused php to consistently segfault. I then tracked it down to a smaller simpler pattern. PHP 5.1.0-dev (cli) (built: Jul 6 2005 10:55:39) Copyright (c) 1997-2005 The PHP Group Zend Engine v2.1.0-dev, Copyright (c) 1998-2004 Zend Technologies Reproduce code: --------------- <?php preg_match('/(?(?=a) (?R) )/x', 'a', $arr); preg_match_all('/(?(?=a) (?R) )/x', 'a', $arr); echo 'fin', "\n"; # will never print ?> Either preg line will cause the fault. Expected result: ---------------- Anything but a segmentation fault, some kind of error would be nice. Actual result: -------------- Segmentation fault gdb: Starting program: /usr/bin/php -f pcrash.php [Thread debugging using libthread_db enabled] [New Thread -1211468032 (LWP 22573)] Program received signal SIGSEGV, Segmentation fault. [Switching to Thread -1211468032 (LWP 22573)] 0xb7f58362 in pcre_compile () from /usr/lib/libpcre.so.3 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=33640&edit=1

« previous php.bugs (#81660) next »