diff --git a/src/wp-includes/html-api/class-wp-html-tag-processor.php b/src/wp-includes/html-api/class-wp-html-tag-processor.php index 0cdcd4cd85531..e868ffe9e89ab 100644 --- a/src/wp-includes/html-api/class-wp-html-tag-processor.php +++ b/src/wp-includes/html-api/class-wp-html-tag-processor.php @@ -1556,24 +1556,33 @@ private function skip_script_data(): bool { } /* - * Unlike with "-->", the "" or "". + * + * Note that this check may advance the position significantly and requires a + * length check to prevent bad offsets on inputs like `', true ), - 'Script data double-escaped exit (closed)' => array( '', true ), - 'Script data double-escaped exit (closed/truncated)' => array( '', true ), - 'Script data no double-escape' => array( '', true ), - - 'Script tag with self-close flag (ignored)' => array( '', true ); + yield 'Script data double-escaped exit (closed)' => array( '', true ); + yield 'Script data double-escaped exit (closed/truncated)' => + array( '', true ); + yield 'Script data no double-escape' => array( '', true ); + yield 'Script data no double-escape (short comment)' => array( '', true ); + yield 'Script data almost double-escaped' => array( '', true ); + yield 'Script data with complex JavaScript' => array( + '', + true, + ); + + yield 'Script tag with self-close flag (ignored)' => array( '