Skip to content

Commit

Permalink
Fix OOB error in WP_Token_Map when reaching the end of a group with n…
Browse files Browse the repository at this point in the history
…o matches.
  • Loading branch information
dmsnell committed Jun 9, 2024
1 parent c480005 commit ac4366b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wp-includes/class-wp-token-map.php
Original file line number Diff line number Diff line change
Expand Up @@ -545,7 +545,7 @@ public function read_token( $text, $offset = 0, &$matched_token_byte_length = nu
$group = $this->large_words[ $group_at / ( $this->key_length + 1 ) ];
$group_length = strlen( $group );
$at = 0;
while ( $at < $group_length ) {
while ( $at + $this->key_length < $group_length ) {
$token_length = unpack( 'C', $group[ $at++ ] )[1];
$token = substr( $group, $at, $token_length );
$at += $token_length;
Expand Down

0 comments on commit ac4366b

Please sign in to comment.