Commit 3aeb2980f0 for wordpress.org

commit 3aeb2980f0ab6476a9a788d4e723880e85b3be83
Author: dmsnell <dmsnell@git.wordpress.org>
Date:   Mon Sep 16 17:57:13 2024 +0000

    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

diff --git a/wp-includes/html-api/class-wp-html-processor.php b/wp-includes/html-api/class-wp-html-processor.php
index 28e5c150a8..cf4f8d7b86 100644
--- a/wp-includes/html-api/class-wp-html-processor.php
+++ b/wp-includes/html-api/class-wp-html-processor.php
@@ -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();
diff --git a/wp-includes/version.php b/wp-includes/version.php
index 7a90d61357..2ca2acd335 100644
--- a/wp-includes/version.php
+++ b/wp-includes/version.php
@@ -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.