Skip to content

Commit ac33aa5

Browse files
committed
Advance the pointer to avoid an infinite loop
1 parent c9f336e commit ac33aa5

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

src/wp-includes/formatting.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ function _esc_attr_single_pass_utf8( $text ) {
996996
}
997997

998998
// Leading zeros are interpreted as zero values; skip them.
999-
$num_at += strspn( $text, '0', $num_at );
999+
$num_at += strspn( $text, '0', $num_at );
10001000

10011001
// No character reference may be only zeros.
10021002
if ( $num_at >= strlen( $text ) ) {
@@ -1097,7 +1097,7 @@ function _esc_attr_single_pass_utf8( $text ) {
10971097
}
10981098

10991099
$name_at += 2;
1100-
$group = $named_character_reference_lookup_table[ $group_key ];
1100+
$group = $named_character_reference_lookup_table[ $group_key ];
11011101

11021102
$i = 0;
11031103
while ( $i < strlen( $group ) ) {
@@ -1149,7 +1149,7 @@ function _esc_attr_single_pass_utf8( $text ) {
11491149
$name_at += $name_length;
11501150

11511151
$semicolon_delta = ';' === $name[ $name_length - 1 ] ? -1 : 0;
1152-
$reference_name = substr( $text, $was_at + 1, $name_at + $name_length - ( $was_at + 1 ) + $semicolon_delta );
1152+
$reference_name = substr( $text, $was_at + 1, $name_at + $name_length - ( $was_at + 1 ) + $semicolon_delta );
11531153

11541154
// Some names are not allowed by WordPress, even though they are permitted by HTML.
11551155
if ( $name_length > 0 && ! in_array( $reference_name, $allowedentitynames, true ) ) {
@@ -1181,6 +1181,7 @@ function _esc_attr_single_pass_utf8( $text ) {
11811181
// It's non-ambiguous, safe to leave it in.
11821182
if ( ! $ambiguous_follower ) {
11831183
$output .= substr( $text, $was_at, $name_at - $was_at );
1184+
$at = $name_at;
11841185
break 2;
11851186
}
11861187

0 commit comments

Comments
 (0)