Last modified: 2012-04-12 13:55:32 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 T25755, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 23755 - ts_parseFloat() in wikibits.js leaks num into global scope
ts_parseFloat() in wikibits.js leaks num into global scope
Status: RESOLVED FIXED
Product: MediaWiki
Classification: Unclassified
JavaScript (Other open bugs)
1.16.x
All All
: Normal minor (vote)
: ---
Assigned To: Michael Dale
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2010-06-01 22:03 UTC by S Page
Modified: 2012-04-12 13:55 UTC (History)
2 users (show)

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


Attachments

Description S Page 2010-06-01 22:03:31 UTC
I was trying to puzzle out table-sorting on Wikipedia using Firebug, and I noticed that ts_parseFloat() in wikibits.js assigns a value to num:

 num = parseFloat( s.replace(/[, ]/g, '').replace("\u2212", '-') );

Because there's no var or let, this adds num to the global scope -- before this line is reached, this.num is undefined, afterwards this.num has a value for all JavaScript.  A fix might be to use the existing local var newNum instead of num here.

I'm no JavaScript wizard, so I apologize if this is intentional.
There are several other variables that were probably intended to be local that get added to this. scope according to Firebug (this.i, etc.)
Comment 1 Derk-Jan Hartman 2010-06-01 23:18:32 UTC
Fixed in r67202

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


Navigation
Links