Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F584927
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
View Options
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
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Jul 5, 5:31 AM (8 h, 24 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
227412
Default Alt Text
(1 KB)
Attached To
Mode
rMW mediawiki
Attached
Detach File
Event Timeline
Log In to Comment