Closed Bug 217257 Opened 21 years ago Closed 21 years ago

decodeURIComponent() produces wrong result

Categories

(Rhino Graveyard :: Core, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: lmb, Assigned: norrisboyd)

Details

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.3) Gecko/20030312 Under Rhino 1.5R4.1, decodeURIComponent() overwrites everything before the first '%' in its result. Reproducible: Always Steps to Reproduce: 1. java Shell 2. js>var u = "http%3a%2f%2fmozilla%2ffoo.html"; decodeURIComponent(u); Actual Results: ://mozilla/foo.html Expected Results: http://mozilla/foo.html I have fixed this bug on my system. The problem is in org.mozilla.javascript.NativeGlobal.decode(Context, String, boolean). Here is a code snippet: if (buf == null) { // decode always compress so result can not be bigger then // str.length() buf = new char[length]; str.getChars(0, k, buf, 0); bufTop = k; // <- I added this line *** }
cc'ing Igor -
I committed the fix. Thanks for reporting this!
Status: NEW → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Trageting as resolved against 1.5R5
Target Milestone: --- → 1.5R5
You need to log in before you can comment on or make changes to this bug.