From 817c701f29c16cf3d5d6dfa290a28fce40b64df9 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Tue, 4 Jul 2023 20:45:23 +0000 Subject: [PATCH] HTML API: Fix a fatal error when processing malformed document with unclosed attribute. Props: dlh, costdev, dmsnell. Fixes: #58637. Built from https://develop.svn.wordpress.org/trunk@56133 git-svn-id: http://core.svn.wordpress.org/trunk@55645 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/html-api/class-wp-html-tag-processor.php | 4 ++++ wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) 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.