diff --git a/libraries/joomla/filter/input.php b/libraries/joomla/filter/input.php index 2f9579dad1dc7..34777ee9787ec 100644 --- a/libraries/joomla/filter/input.php +++ b/libraries/joomla/filter/input.php @@ -1103,7 +1103,7 @@ protected function escapeAttributeValues($source) // We have a closing quote, convert its byte position to a UTF-8 string length, using non-multibyte substr() $stringBeforeQuote = substr($attributeValueRemainder, 0, $matches[0][1]); $closeQuoteChars = StringHelper::strlen($stringBeforeQuote); - $nextAfter = $nextBefore + $matches[0][1]; + $nextAfter = $nextBefore + $closeQuoteChars; } else { diff --git a/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php b/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php index 874b7527f9c1b..f6bd6297b66da 100644 --- a/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php +++ b/tests/unit/suites/libraries/joomla/filter/JFilterInputTest.php @@ -1294,6 +1294,12 @@ public function blacklist() '', 'Test empty alt attribute' ), + 'infinte_loop_c' => array( + 'string', + '
', + '
', + 'Test correct position of close quote in UTF-8 value' + ), 'quotes_in_text' => array( 'string', $quotesInText1,