diff --git a/wp-includes/html-api/class-wp-html-tag-processor.php b/wp-includes/html-api/class-wp-html-tag-processor.php
index 54721df406..b9214f2d4c 100644
--- a/wp-includes/html-api/class-wp-html-tag-processor.php
+++ b/wp-includes/html-api/class-wp-html-tag-processor.php
@@ -546,6 +546,10 @@ class WP_HTML_Tag_Processor {
}
// Ensure that the tag closes before the end of the document.
+ if ( $this->bytes_already_parsed >= strlen( $this->html ) ) {
+ return false;
+ }
+
$tag_ends_at = strpos( $this->html, '>', $this->bytes_already_parsed );
if ( false === $tag_ends_at ) {
return false;
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 54baec6059..f3566ba06d 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
-$wp_version = '6.3-beta3-56132';
+$wp_version = '6.3-beta3-56133';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.