#50264 [Bgs]: Possible pcre memory leak

From: Date: Sat, 28 Nov 2009 16:52:56 +0000
Subject: #50264 [Bgs]: Possible pcre memory leak
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-145164@lists.php.net to get a copy of this message
ID: 50264 User updated by: laszlo dot janszky at gmail dot com Reported By: laszlo dot janszky at gmail dot com Status: Bogus Bug Type: PCRE related Operating System: Windows XP PHP Version: 5.3.1 New Comment: Ok. For last, here is my backtrace memory tester. If it's not a bug, then bye bye. <?php header('content-type: text/html; charset=utf-8'); header("Cache-Control: no-cache, must-revalidate"); header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); ini_set('pcre.recursion_limit', 10000); $kb=1024; $Mb=1024*1024; $max_memory_size=50*$Mb; $pattern= '% {(\w+)(?:} (.*?(?:(?0).*?)*?) {/\1)?} %usDx'; if (isset($_POST['test']) && $_POST['test']!='') { ini_set('pcre.backtrack_limit', $max_memory_size); if (preg_match_all($pattern,$_POST['test'],$m,PREG_SET_ORDER)) { $a=1; $b=$max_memory_size; while (abs($a-$b)>1) { $c=(int)(($a+$b)/2); ini_set('pcre.backtrack_limit', $c); if (preg_match_all($pattern,$_POST['test'],$m,PREG_SET_ORDER)) { $b=$c; } else { $a=$c; } } } ?><div style="float: left; margin: 10px; "><?php if (isset($c)) { ?>A fogyasztott memória:<br /><?php echo ($c/$kb); ?>.kb.<br /><?php } else { ?>A memória fogyasztás túllépte az engedélyezett kvótát, vagy a minta nem illeszkedik.<br /><?php } ?><br /><br />A tesztelt szöveg: <br /><pre><?php echo $_POST['test']; ?></pre><?php ?></div><?php } ?> <div style="float: left; margin: 10px;"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="application/x-www-urlencoded; charset=utf-8"> <input type="submit" value="test1" style="vertical-align: top" /> <textarea id="test1" name="test" rows="18"> 1.){display} 2.){display} 3.){display} 4.){display} 5.){display} 6.){display} 7.){display} 8.){display} 9.){display} </textarea> </form> </div> <div style="float: left; margin: 10px;"> <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post" enctype="application/x-www-urlencoded; charset=utf-8"> <input type="submit" value="test2" style="vertical-align: top" /> <textarea id="test2" name="test" rows="18"> 1.){display} 2.){display} 3.){display} 4.){display} 5.){display} 6.){display} 7.){display} 8.){display} 9.){display} {/display} {/display} {/display} {/display} {/display} {/display} {/display} {/display} {/display} </textarea> </form> </div> Previous Comments: ------------------------------------------------------------------------ [2009-11-28 02:40:16] laszlo dot janszky at gmail dot com "Did you test it with the command line pcre test tool?" I did not test it. ------------------------------------------------------------------------ [2009-11-28 02:37:58] laszlo dot janszky at gmail dot com Ahm, so you mean, this is a pcre memory handling problem, not a php bug? Okay, then where can I report this issue? (Sorry for the bad English, I'm just med- ...) ------------------------------------------------------------------------ [2009-11-27 23:26:10] rasmus@php.net Did you test it with the command line pcre test tool? This is unlikely to have anything to do with php-specific code. ------------------------------------------------------------------------ [2009-11-27 23:07:01] laszlo dot janszky at gmail dot com OK. If it's not a bug, then what is it? ------------------------------------------------------------------------ [2009-11-27 17:57:16] jani@php.net Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at http://bugs.php.net/50264 -- Edit this bug report at http://bugs.php.net/?id=50264&edit=1

« previous php.bugs (#145164) next »