From 53b738c1e446f1a5310326d79744017ac317852c Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Sun, 16 Apr 2006 00:35:22 +0000 Subject: [PATCH] Fix the ineffective infinite loop protection. git-svn-id: http://htmlpurifier.org/svnroot/html_purifier/trunk@27 48356398-32a2-884e-a903-53898d9a118a --- HTML_Lexer.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/HTML_Lexer.php b/HTML_Lexer.php index f02bdee9..53dfc771 100644 --- a/HTML_Lexer.php +++ b/HTML_Lexer.php @@ -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);