Page MenuHomePhabricator

JavaScript exception thrown by decodeURI on SpecialBannerController should be caught
Closed, ResolvedPublic

Description

Author: mr.heat

Description:
The file:

mediawiki/extensions/CentralNotice/special/SpecialBannerController.php

may crash with a "Malformed URI" exception when executing the line:

return decodeURIComponent( s.split( '+' ).join( ' ' ) );

Here is a very simple example to trigger this error:

http://de.wikipedia.org/w/index.php?title=Wikipedia:CentralNotice&action=edit&summary=%E4

I know, this *is* a malformed URI (it's not UTF-8). Thats not the problem. The problem is: This stops *all* other scripts including the WikiEditor. This is why I consider this a "blocker".

Expected behavior: The CentralNotice extension should never interfere with other scripts, not even if there *is* an error.

Solution: decodeURI and decodeURIComponent must *always* be surrounded by a try-catch block.

https://gerrit.wikimedia.org/r/gitweb?p=mediawiki/extensions/CentralNotice.git;a=blame;f=special/SpecialBannerController.php;h=531072f79f22a6797070a6828284f91114f515ff;hb=HEAD


Version: master
Severity: major

Details

Reference
bz38805

Event Timeline

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

Fixed in Icab22e6e858e95c8197f51f72d958608a87d6fd5 (that is the only use of decodeURIComponent within the extension)

  • Bug 33098 has been marked as a duplicate of this bug. ***

*** Bug 25846 has been marked as a duplicate of this bug. ***