0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-09-20 03:05:18 +00:00

Peephole optimization for infinite loop protection code.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@29 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-04-16 00:37:57 +00:00
parent 20e027646d
commit 6248b05d0e

View File

@ -62,8 +62,7 @@ class HTML_Lexer
while(true) {
// infinite loop protection
$loops++;
if ($loops > 200000) return array();
if (++$loops > 200000) return array();
$position_next_lt = strpos($string, '<', $cursor);
$position_next_gt = strpos($string, '>', $cursor);
@ -173,8 +172,7 @@ class HTML_Lexer
// infinite loop protection
// if we've looped 1000 times, abort. Nothing good can come of this
$loops++;
if ($loops > 1000) return array();
if (++$loops > 1000) return array();
if ($cursor >= $size) {
break;