HTML API: Prevent infinite loop in foreign content reprocessing step.

An infinite loop was discovered in specific situations within foreign content inside the HTML Processor when a given node inside foreign content must be handled in the rules for the current insertion mode.

This patch resolves the loop by handling those nodes directly instead of reprocessing the node, which previously was redirecting control flow back to where the loop started.

Developed in https://github.com/wordpress/wordpress-develop/7347
Discussed in https://core.trac.wordpress.org/ticket/61656

Follow-up to [58868].

Props jonsurrell.
See #61576.


Built from https://develop.svn.wordpress.org/trunk@59024


git-svn-id: http://core.svn.wordpress.org/trunk@58420 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
dmsnell 2024-09-16 17:57:13 +00:00
parent 6b56a33bfa
commit 3aeb2980f0
2 changed files with 3 additions and 2 deletions

View File

@ -4501,7 +4501,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
$this->state->stack_of_open_elements->pop();
}
return $this->step( self::REPROCESS_CURRENT_NODE );
goto in_foreign_content_process_in_current_insertion_mode;
}
/*
@ -4577,6 +4577,7 @@ class WP_HTML_Processor extends WP_HTML_Tag_Processor {
goto in_foreign_content_end_tag_loop;
}
in_foreign_content_process_in_current_insertion_mode:
switch ( $this->state->insertion_mode ) {
case WP_HTML_Processor_State::INSERTION_MODE_INITIAL:
return $this->step_initial();

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.7-alpha-59023';
$wp_version = '6.7-alpha-59024';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.