mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-12-31 20:01:52 +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:
parent
9f1d145322
commit
53b738c1e4
@ -56,12 +56,14 @@ class HTML_Lexer
|
|||||||
|
|
||||||
// infinite loop protection
|
// infinite loop protection
|
||||||
// has to be pretty big, since html docs can be big
|
// has to be pretty big, since html docs can be big
|
||||||
|
// we're allow two hundred thousand tags... more than enough?
|
||||||
$loops = 0;
|
$loops = 0;
|
||||||
|
|
||||||
while(true) {
|
while(true) {
|
||||||
|
|
||||||
// infinite loop protection
|
// infinite loop protection
|
||||||
if ($loops > 1000000000) return array();
|
$loops++;
|
||||||
|
if ($loops > 200000) return array();
|
||||||
|
|
||||||
$position_next_lt = strpos($string, '<', $cursor);
|
$position_next_lt = strpos($string, '<', $cursor);
|
||||||
$position_next_gt = strpos($string, '>', $cursor);
|
$position_next_gt = strpos($string, '>', $cursor);
|
||||||
|
Loading…
Reference in New Issue
Block a user