Bug Tracker

Opened 13 years ago

Closed 12 years ago

Last modified 12 years ago

#5610 closed bug (worksforme)

makeArray can cause browser crash on non array objects with length property

Reported by: jwheare Owned by:
Priority: high Milestone: 1.5
Component: core Version: 1.5
Keywords: Cc:
Blocked by: Blocking:


I haven't tested this with 1.4

For an object with a length property that casts to a non-zero positive integer, makeArray will create an array with that length filled with undefined.

>>> jQuery.makeArray({'length': '5'})
[undefined, undefined, undefined, undefined, undefined]

If the length property is zero, negative or a decimal then Firefox and Safari both hang. (FF shows the unresponsive script error, Safari hangs until it crashes)

>>> jQuery.makeArray({'length': '0'})
>>> jQuery.makeArray({'length': '5.2'})
>>> jQuery.makeArray({'length': '-3'})

Change History (5)

comment:1 Changed 13 years ago by john

Resolution: fixed
Status: newclosed

comment:2 Changed 13 years ago by 314159abcde

Resolution: fixed
Status: closedreopened

This has not been corrected.


jQuery.makeArray( {'length':5} );

in the firebug console on any jQuery site and it will output [undefined, undefined, undefined, undefined, undefined]

when it should return [Object { length=5}]

This is causing issues where I have an object with a length and width attribute, since it will not pass through makeArray properly.

comment:3 Changed 12 years ago by snover

Priority: majorhigh
Resolution: worksforme
Status: reopenedclosed
Version: 1.4a11.4.4

It is working as designed.

comment:4 Changed 12 years ago by john


There wasn't a 1.4.5 release, was actually 1.5.

comment:5 Changed 12 years ago by john


There was no 1.4.5 release, was actually 1.5.

Note: See TracTickets for help on using tickets.