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
This commit is contained in:
Andrew Ozz 2023-07-04 20:45:23 +00:00
parent 67863b9fb7
commit 817c701f29
2 changed files with 5 additions and 1 deletions

View File

@ -546,6 +546,10 @@ class WP_HTML_Tag_Processor {
} }
// Ensure that the tag closes before the end of the document. // 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 ); $tag_ends_at = strpos( $this->html, '>', $this->bytes_already_parsed );
if ( false === $tag_ends_at ) { if ( false === $tag_ends_at ) {
return false; return false;

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @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. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.