#40004 [Opn->Bgs]: preg_match() with /u flag corrupts memory

From: Date: Thu, 11 Jan 2007 09:49:23 +0000
Subject: #40004 [Opn->Bgs]: preg_match() with /u flag corrupts memory
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-107460@lists.php.net to get a copy of this message
ID: 40004 Updated by: tony2001@php.net Reported By: php at koterov dot ru -Status: Open +Status: Bogus Bug Type: PCRE related Operating System: Windows XP PHP Version: 4.4.4 New Comment: First of all, it's a PCRE library problem. And it's fixed in newer PCRE versions which are bundled in recent PHP releases. Previous Comments: ------------------------------------------------------------------------ [2007-01-03 00:16:40] php at koterov dot ru This is also reproducible in command-line php.exe PHP 4.4.4 PHP 5.1.6 (!) Cannot reproduce on PHP 5.2.0. ------------------------------------------------------------------------ [2007-01-03 00:10:57] php at koterov dot ru Description: ------------ Seems preg_match with /u modifier corrupts process memory or returns pointer to nirvana instead of pointer to a string. Reproduce code: --------------- <? preg_match('/(.{0,20})$/us', " ", $m); var_export($m); ?> Expected result: ---------------- space Actual result: -------------- something like array ( 0 => ' kjwekwjn', 1 => ' wereinoiu', ) where "kjwekwjn" and "wereinoiu" are random strings with random binary data (useless to copy-paste them here). ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=40004&edit=1

« previous php.bugs (#107460) next »