Page MenuHomePhorge

No OneTemporary

Size
1 KB
Referenced Files
None
Subscribers
None
diff --git a/includes/libs/mime/XmlTypeCheck.php b/includes/libs/mime/XmlTypeCheck.php
index 7f3427c57d2..6e837cc1fe9 100644
--- a/includes/libs/mime/XmlTypeCheck.php
+++ b/includes/libs/mime/XmlTypeCheck.php
@@ -167,11 +167,19 @@ class XmlTypeCheck {
* @param bool $isFile
*/
private function validateFromInput( $xml, $isFile ) {
+ // Allow text and attr nodes over 10 MB, e.g. embedded embedded raster images in SVG (T387969).
+ $xmlParseHuge = LIBXML_PARSEHUGE;
+ if ( defined( 'MW_PHPUNIT_TEST' ) ) {
+ // Use low limits while running tests, because XmlTypeCheckTest::testRecursiveEntity()
+ // requires over 1 GB of memory and over a minute of time with huge limits (T392782).
+ // Maybe this should be configurable for low-resource deployments?
+ $xmlParseHuge = 0;
+ }
$reader = new XMLReader();
if ( $isFile ) {
- $s = $reader->open( $xml, null, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_PARSEHUGE );
+ $s = $reader->open( $xml, null, LIBXML_NOERROR | LIBXML_NOWARNING | $xmlParseHuge );
} else {
- $s = $reader->XML( $xml, null, LIBXML_NOERROR | LIBXML_NOWARNING | LIBXML_PARSEHUGE );
+ $s = $reader->XML( $xml, null, LIBXML_NOERROR | LIBXML_NOWARNING | $xmlParseHuge );
}
if ( $s !== true ) {
// Couldn't open the XML

File Metadata

Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:31 AM (11 h, 17 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227412
Default Alt Text
(1 KB)

Event Timeline