avoid possibility of infinite loop in bbcode parsing
This commit is contained in:
parent
caa6d59a87
commit
63aa4c6330
1 changed files with 4 additions and 0 deletions
|
@ -99,6 +99,8 @@ class BBCode extends FormatterExtension {
|
||||||
$end = strpos($text, "[/spoiler]");
|
$end = strpos($text, "[/spoiler]");
|
||||||
if($end === false) break;
|
if($end === false) break;
|
||||||
|
|
||||||
|
if($end < $start) break;
|
||||||
|
|
||||||
$beginning = substr($text, 0, $start);
|
$beginning = substr($text, 0, $start);
|
||||||
$middle = str_rot13(substr($text, $start+$l1, ($end-$start-$l1)));
|
$middle = str_rot13(substr($text, $start+$l1, ($end-$start-$l1)));
|
||||||
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
|
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
|
||||||
|
@ -124,6 +126,8 @@ class BBCode extends FormatterExtension {
|
||||||
$end = strpos($text, "[/code]", $start);
|
$end = strpos($text, "[/code]", $start);
|
||||||
if($end === false) break;
|
if($end === false) break;
|
||||||
|
|
||||||
|
if($end < $start) break;
|
||||||
|
|
||||||
$beginning = substr($text, 0, $start);
|
$beginning = substr($text, 0, $start);
|
||||||
$middle = base64_encode(substr($text, $start+$l1, ($end-$start-$l1)));
|
$middle = base64_encode(substr($text, $start+$l1, ($end-$start-$l1)));
|
||||||
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
|
$ending = substr($text, $end + $l2, (strlen($text)-$end+$l2));
|
||||||
|
|
Reference in a new issue