Page MenuHomePhabricator

PHP Warning: XMLReader::open(): Memory allocation failed : escaping URI value
Closed, ResolvedPublicPRODUCTION ERROR

Description

Error

MediaWiki version: 1.35.0-wmf.15

message
PHP Warning: XMLReader::open(): Memory allocation failed : escaping URI value

Impact

There's a few dozen of these. I have no idea what's up. So far I don't think they are a train blocker, but it would be good for someone to take a look.

Notes

https://phabricator.wikimedia.org/F31514344 is the offending file

Details

Request ID
XiBgsgpAEDEAAFZge94AAAHI
Request URL
https://commons.wikimedia.org/w/api.php
Stack Trace
exception.trace
#0 [internal function]: MWExceptionHandler::handleError(integer, string, string, integer, array)
#1 /srv/mediawiki/php-1.35.0-wmf.15/vendor/wikimedia/xmp-reader/src/Reader.php(556): XMLReader->open(string, NULL, integer)
#2 /srv/mediawiki/php-1.35.0-wmf.15/vendor/wikimedia/xmp-reader/src/Reader.php(359): Wikimedia\XMPReader\Reader->checkParseSafety(string)
#3 /srv/mediawiki/php-1.35.0-wmf.15/includes/media/BitmapMetadataHandler.php(210): Wikimedia\XMPReader\Reader->parse(string)
#4 /srv/mediawiki/php-1.35.0-wmf.15/includes/media/PNGHandler.php(39): BitmapMetadataHandler::PNG(string)
#5 /srv/mediawiki/php-1.35.0-wmf.15/includes/utils/MWFileProps.php(84): PNGHandler->getMetadata(FSFile, string)
#6 /srv/mediawiki/php-1.35.0-wmf.15/includes/upload/UploadBase.php(474): MWFileProps->getPropsFromPath(string, string)
#7 /srv/mediawiki/php-1.35.0-wmf.15/includes/upload/UploadBase.php(376): UploadBase->verifyFile()
#8 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiUpload.php(561): UploadBase->verifyUpload()
#9 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiUpload.php(89): ApiUpload->verifyUpload()
#10 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiMain.php(1603): ApiUpload->execute()
#11 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiMain.php(539): ApiMain->executeAction()
#12 /srv/mediawiki/php-1.35.0-wmf.15/includes/api/ApiMain.php(510): ApiMain->executeActionWithErrorHandling()
#13 /srv/mediawiki/php-1.35.0-wmf.15/api.php(78): ApiMain->execute()
#14 /srv/mediawiki/w/api.php(3): require(string)
#15 {main}
Related Changes in Gerrit:

Event Timeline

Trying the image (https://commons.wikimedia.org/wiki/File:Bahri_BODUR.png - marked for deletion, will put a copy in the description) locally I also get

Warning: XMLReader::open(): Memory allocation failed : reaching arbitrary MAX_URI_LENGTH limit in /var/www/wiki/mediawiki/vendor/wikimedia/xmp-reader/src/Reader.php on line 556

brooke subscribed.

This seems to be due to a corruption problem in Photoshop or some other editing tool that produces a huge amount of extra junk data in the XMP metadata. You can find reports of this problem on forums like here: https://feedback.photoshop.com/photoshop_family/topics/corrupt-ancestors-tag-in-xmp-causing-giant-file-sizes-in-photoshop

This inflates the XMP's XML data to the size that, when encoded as a data URI, it exceeds the 1 MiB arbitrary limit for URI processing in libxml2 when we try to parse it that way in checkParseData.

We could reject the metadata explicitly when this size, or find a way to parse it that doesn't require using a data URI.

Change 565351 had a related patch set uploaded (by Brion VIBBER; owner: Brion VIBBER):
[mediawiki/libs/XMPReader@master] Bail out of checkParseSafety early on too-long data

https://gerrit.wikimedia.org/r/565351

Change 565351 merged by jenkins-bot:
[mediawiki/libs/XMPReader@master] Bail out of checkParseSafety early on too-long data

https://gerrit.wikimedia.org/r/565351

Change 565364 had a related patch set uploaded (by Brion VIBBER; owner: Brion VIBBER):
[mediawiki/core@master] Bump xmp-reader to 0.7.0

https://gerrit.wikimedia.org/r/565364

Change 565365 had a related patch set uploaded (by Brion VIBBER; owner: Brion VIBBER):
[mediawiki/vendor@master] Update xmp-reader to 0.7.0

https://gerrit.wikimedia.org/r/565365

Change 565365 merged by jenkins-bot:
[mediawiki/vendor@master] Update xmp-reader to 0.7.0

https://gerrit.wikimedia.org/r/565365

Change 565364 merged by jenkins-bot:
[mediawiki/core@master] Bump xmp-reader to 0.7.0

https://gerrit.wikimedia.org/r/565364

Jdforrester-WMF subscribed.

Should be fixed in wmf.16.