Page MenuHomePhabricator

rsvg large stderr cause a PHP memory exhaustion
Closed, ResolvedPublic

Description

I have spotted on the Wikimedia cluster a SVG image that cause RSVG to generate roughly 125MB of stderr output.

In includes/media/SVG.php we log that error using something like:

wfDebugLog( 'thumbnails', trim($stderr) );

trim() thus returns a copy of $stderr (aka roughly 125MB) which can't be allocated by PHP under its max memory constraint. That result in a fatal error and no log at all.

Which should probably substr() the $stderr before handling it. No point in logging the full error IMHO.


Version: unspecified
Severity: normal

Details

Reference
bz57985

Event Timeline

bzimport raised the priority of this task from to Needs Triage.Nov 22 2014, 2:17 AM
bzimport set Reference to bz57985.
bzimport added a subscriber: Unknown Object (MLST).

Change 99142 had a related patch set uploaded by Hashar:
generalize BitmapHandler::logErrorForExternalProcess

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

Change 99157 had a related patch set uploaded by Hashar:
media: limit size of stderr being logged

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

Change 99142 merged by Brian Wolff:
generalize BitmapHandler::logErrorForExternalProcess

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

Change 99157 merged by jenkins-bot:
media: limit size of stderr being logged

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