[wp-trac] [WordPress Trac] #61810: HTML API: Parser may hang on some unclosed script tag inputs

WordPress Trac noreply at wordpress.org
Fri Aug 2 23:47:02 UTC 2024


#61810: HTML API: Parser may hang on some unclosed script tag inputs
--------------------------------------+-------------------------
 Reporter:  jonsurrell                |       Owner:  jonsurrell
     Type:  defect (bug)              |      Status:  closed
 Priority:  normal                    |   Milestone:  6.6.2
Component:  HTML API                  |     Version:  6.5
 Severity:  normal                    |  Resolution:  fixed
 Keywords:  has-patch has-unit-tests  |     Focuses:
--------------------------------------+-------------------------
Changes (by dmsnell):

 * status:  assigned => closed
 * resolution:   => fixed


Comment:

 In [changeset:"58845" 58845]:
 {{{
 #!CommitTicketReference repository="" revision="58845"
 HTML API: Fix an infinite loop in certain unclosed SCRIPT tags.

 When the Tag Processor (or HTML Processor) attempts to parse certain
 incomplete script tags, the parser enters an infinite loop and will
 hang indefinitely. The conditions to reach this situation are:

 - Input HTML ends with an open script tag.
 - The final character of input is `-` or `<`.

 The infinite loop was caused by the parser-advancing increment not being
 called when two `||` OR conditions short-circuited. If the first
 condition was true, the `$at++` code was never reached.

 This path resolves the issue.

 Developed in https://github.com/wordpress/wordpress-develop/pull/7128
 Discussed in https://core.trac.wordpress.org/ticket/61810

 Follow-up to [55203].

 Props: dmsnell, jonsurrell.
 Fixes #61810.
 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/61810#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list