#23616 [NEW]: preg_match() segfault

From: Date: Tue, 13 May 2003 20:33:33 +0000
Subject: #23616 [NEW]: preg_match() segfault
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-39550@lists.php.net to get a copy of this message
From: cestmir at nustep dot net Operating system: Linux Debian, Win32 PHP version: 4.3.1 PHP Bug Type: PCRE related Bug description: preg_match() segfault This code causes a segfault both on Linux and Win32 builds. <?php function utf8IsValidString($AStr) { $ptrASCII = '[\x00-\x7F]'; $ptr2Octet = '[\xC2-\xDF][\x80-\xBF]'; $ptr3Octet = '[\xE0-\xEF][\x80-\xBF]{2}'; $ptr4Octet = '[\xF0-\xF4][\x80-\xBF]{3}'; $ptr5Octet = '[\xF8-\xFB][\x80-\xBF]{4}'; $ptr6Octet = '[\xFC-\xFD][\x80-\xBF]{5}'; return preg_match("/^($ptrASCII|$ptr2Octet|$ptr3Octet|$ptr4Octet|$ptr5Octet|$ptr6Octet)*$/s", $AStr); } // read text $handle = fopen('utf8text.txt', 'r'); $stat = fstat($handle); $str = fread($handle, $stat['size']); fclose($handle); // execute PCRE match var_dump(utf8IsValidString("some short text \xC4\xBE\xC5\xA1")); // ok var_dump(utf8IsValidString($str)); // segfault ?> This code including data file to reproduce bug can be found here: http://www.omikron.sk/downloads/pcre_crash.tar -- Edit bug report at http://bugs.php.net/?id=23616&edit=1 -- Try a CVS snapshot: http://bugs.php.net/fix.php?id=23616&r=trysnapshot Fixed in CVS: http://bugs.php.net/fix.php?id=23616&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=23616&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=23616&r=needtrace Try newer version: http://bugs.php.net/fix.php?id=23616&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=23616&r=support Expected behavior: http://bugs.php.net/fix.php?id=23616&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=23616&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=23616&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=23616&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=23616&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=23616&r=dst IIS Stability: http://bugs.php.net/fix.php?id=23616&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=23616&r=gnused

« previous php.bugs (#39550) next »