From 5886326cd0d0e2415b58f90eb65fde2d28ae44eb Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 6 Mar 2017 23:26:55 -0800 Subject: [PATCH] Test for catastrophic backtracking. Signed-off-by: Edward Z. Yang --- tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php b/tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php index 670ca0b2..e0c398f7 100644 --- a/tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php +++ b/tests/HTMLPurifier/Filter/ExtractStyleBlocksTest.php @@ -256,6 +256,12 @@ text-align:center $this->assertCleanCSS("a .foo #ID div.cl#foo {\nbackground:url(\"http://foo/BAR\")\n}"); } + public function test_extractStyleBlocks_backtracking() + { + $goo = str_repeat("a", 1000000); // 1M to trigger, sometimes it's less! + $this->assertExtractStyleBlocks("" . $goo, $goo, array('')); + } + } // vim: et sw=4 sts=4 -- 2.11.4.GIT