Make WordPress Core

Changeset 59024


Ignore:
Timestamp:
09/16/2024 05:54:08 PM (6 months ago)
Author:
dmsnell
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/html-api/class-wp-html-processor.php

    r59014 r59024  
    45024502                    $this->state->stack_of_open_elements->pop();
    45034503                }
    4504                 return $this->step( self::REPROCESS_CURRENT_NODE );
     4504                goto in_foreign_content_process_in_current_insertion_mode;
    45054505        }
    45064506
     
    45784578            }
    45794579
     4580            in_foreign_content_process_in_current_insertion_mode:
    45804581            switch ( $this->state->insertion_mode ) {
    45814582                case WP_HTML_Processor_State::INSERTION_MODE_INITIAL:
Note: See TracChangeset for help on using the changeset viewer.