0
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2024-12-22 16:31:53 +00:00

Fix the ineffective infinite loop protection.

git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@27 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang 2006-04-16 00:35:22 +00:00
parent 9f1d145322
commit 53b738c1e4

View File

@ -56,12 +56,14 @@ class HTML_Lexer
// infinite loop protection
// has to be pretty big, since html docs can be big
// we're allow two hundred thousand tags... more than enough?
$loops = 0;
while(true) {
// infinite loop protection
if ($loops > 1000000000) return array();
$loops++;
if ($loops > 200000) return array();
$position_next_lt = strpos($string, '<', $cursor);
$position_next_gt = strpos($string, '>', $cursor);