New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 2 users

Issue metadata

Status: Fixed
Email to this user bounced
Closed: Jan 2011
HW: ----
NextAction: ----
OS: ----
Priority: ----
Type: ----

Sign in to add a comment can results in incorrect array length

Reported by, Jan 17 2011

Issue description

Within a function, if any value is assigned to a variable defined as a parameter, arguments.length will be interpreted incorrectly when using Array.prototype.slice to convert the arguments to an actual array.

The following examples show the problem:
(function(a) { a = 0; return []; }()) //=> 17
(function(a,b) { b = 0; return []; }()) //=> 19
(function(a,b,c) { c = 0; return []; }()) //=> 20

The numbers continue to grow as you add more parameters, but the value is based on whichever parameter is reassigned first.
(function(a,b,c) { a = 0; c = 0; return []; }()) //=> 17
(function(a,b,c) { c = 0; a = 0; return []; }()) //=> 20

Tested in and 3.0.7.

Comment 1 by, Jan 17 2011

Status: PendingFurtherInfo
May I ask you to check if the problem still persists in 3.0.8?

It should have been solved by which only went to 3.0.8.
Unfortunately I'm not sure how to build V8 on OS X in order to test out 3.0.8. I was using Chrome to do my testing and it doesn't have 3.0.8 yet. I did a checkout of V8, but couldn't get gyp to create a Makefile for me.

Comment 3 by, Jan 18 2011

Status: Fixed
NP, I ran five samples above myself and they all now produce 0 which is right (I think).

Just FYI.  You don't have to build v8 as a part of Chromium: if you have scons installed (, you can build v8's shell with scons sample=shell.

I am closing the bug as fixed.  Please, reopen if this problem shows up again.
I was following the instructions in /build/README.txt which say to use gyp. I installed scons and was able to build from trunk. I ran a few tests, including actually passing parameters and everything seems to be working properly now. Thanks.

Sign in to add a comment