From: Brian Wolff Date: Wed, 6 Jul 2016 22:55:12 +0000 (-0400) Subject: Add a test for entity expansion OOM in XmlTypeCheck X-Git-Tag: 1.31.0-rc.0~6336^2 X-Git-Url: http://git.cyclocoop.org/wiki/Target_page?a=commitdiff_plain;h=da638d6b6ef9bd38559dc9ae7c4a732547bd48d8;p=lhc%2Fweb%2Fwiklou.git Add a test for entity expansion OOM in XmlTypeCheck Change-Id: Ia255178fc893a715fd44e5c69399575ee7b12cfd --- diff --git a/tests/phpunit/includes/libs/XmlTypeCheckTest.php b/tests/phpunit/includes/libs/XmlTypeCheckTest.php index 80efcb3172..7f9a772aa7 100644 --- a/tests/phpunit/includes/libs/XmlTypeCheckTest.php +++ b/tests/phpunit/includes/libs/XmlTypeCheckTest.php @@ -30,6 +30,32 @@ class XmlTypeCheckTest extends PHPUnit_Framework_TestCase { $this->assertFalse( $testXML->wellFormed ); } + /** + * Verify we check for recursive entity DOS + * + * (If the DOS isn't properly handled, the test runner will probably go OOM...) + */ + public function testRecursiveEntity() { + $xml = <<<'XML' + + + + + + + + + +]> + +&test; + +XML; + $check = XmlTypeCheck::newFromString( $xml ); + $this->assertFalse( $check->wellFormed ); + } + /** * @covers XMLTypeCheck::processingInstructionHandler */