Last modified: 2014-05-24 15:45:42 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T60553, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 58553 - Invalid xml accepted by svg upload
Invalid xml accepted by svg upload
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
Uploading (Other open bugs)
unspecified
All All
: Normal normal (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on: 65724
Blocks: 59830
  Show dependency treegraph
 
Reported: 2013-12-16 21:56 UTC by Chris Steipp
Modified: 2014-05-24 15:45 UTC (History)
11 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments
Return error on invalid XML (1.98 KB, patch)
2013-12-17 00:48 UTC, Chris Steipp
Details
Return error if XML can't be parsed for SVGs (3.15 KB, patch)
2013-12-17 21:12 UTC, Chris Steipp
Details
Patch rebased on the patch for bug 57550 (3.28 KB, patch)
2013-12-19 21:35 UTC, Chris Steipp
Details
Return error if XML can't be parsed for SVGs (1.19 branch) (3.18 KB, patch)
2014-01-08 23:11 UTC, Markus Glaser
Details
Return error if XML can't be parsed for SVGs (1.21 branch) (3.20 KB, patch)
2014-01-08 23:11 UTC, Markus Glaser
Details
Return error if XML can't be parsed for SVGs (1.22 branch) (3.20 KB, patch)
2014-01-08 23:12 UTC, Markus Glaser
Details

Description Chris Steipp 2013-12-16 21:56:04 UTC
Tim pointed out on bug 57550 that our SVG script checker doesn't check to ensure that the xml parser found the svg to be well formed. The checkSvgScriptCallback isn't called for any part of the svg following invalid xml, so anything that would be caught as a script in checkSvgScriptCallback is skipped.

In testing, it appears that modern versions of FF/Chrome/Opera all stop rendering svg files when they encounter invalid xml.

However, in case any older browsers ignore errors, we should also reject invalid xml for SVG uploads.
Comment 1 Tim Starling 2013-12-17 00:41:35 UTC
The cases where xml_parse() returns false is broader than the strict definition of invalid XML. For example, libxml loads the values of attributes into dynamically allocated memory. With ulimit/cgroup limiting memory usage, the malloc() can return NULL, which leads to xml_parse() returning 0 and giving a PHP warning like:

Warning: xml_parse(): Memory allocation failed : growing buffer in /srv/mw/core/includes/libs/XmlTypeCheck.php on line 124
Comment 2 Chris Steipp 2013-12-17 00:48:41 UTC
Created attachment 14116 [details]
Return error on invalid XML
Comment 3 Chris Steipp 2013-12-17 00:49:48 UTC
Hmm.. didn't see your comment until I posted that. Perhaps the error should be "Couldn't parse the XML"?
Comment 4 Chris Steipp 2013-12-17 21:12:48 UTC
Created attachment 14124 [details]
Return error if XML can't be parsed for SVGs

Added the translations to this version. Updated the message per Tim's comment.
Comment 5 Tim Starling 2013-12-18 23:57:13 UTC
Looks good.
Comment 6 Chris Steipp 2013-12-19 21:35:31 UTC
Created attachment 14143 [details]
Patch rebased on the patch for bug 57550
Comment 7 Chris Steipp 2013-12-23 18:29:58 UTC
This was assigned CVE-2013-6453
Comment 8 Markus Glaser 2014-01-08 23:11:14 UTC
Created attachment 14267 [details]
Return error if XML can't be parsed for SVGs (1.19 branch)
Comment 9 Markus Glaser 2014-01-08 23:11:45 UTC
Created attachment 14268 [details]
Return error if XML can't be parsed for SVGs (1.21 branch)
Comment 10 Markus Glaser 2014-01-08 23:12:16 UTC
Created attachment 14269 [details]
Return error if XML can't be parsed for SVGs (1.22 branch)

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links