Skip to main content

length_value

Function length_value 

Source
pub fn length_value(length: usize) -> Value
Expand description

An array’s length as a JavaScript number.

Value::Int only holds an i32, and an array’s length may legitimately reach 2^32-1, so a plain cast is not enough: a[2**32-2] = 1; a.length came back as -1, and Object.getOwnPropertyDescriptor(a, "length").value with it. Every LengthOfArrayLike over such an array then ran to -1, and the paths without their own RangeError check turned into memory allocation of 68719476720 bytes failed.