mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 23:28:42 +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:
parent
20e027646d
commit
6248b05d0e
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user