Bug 185625 - Array#indexOf not finding items in array like objects with .length >= 2 ** 32
Summary: Array#indexOf not finding items in array like objects with .length >= 2 ** 32
Status: RESOLVED DUPLICATE of bug 163417
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-14 14:25 PDT by Leo Balter
Modified: 2020-04-03 09:46 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Leo Balter 2018-05-14 14:25:10 PDT
This predates to ES5.1 where the Array were bound to a max length of 2 ** 32. 

See https://es5.github.io/#x15.4.4.14

Test262:
test/built-ins/Array/prototype/indexOf/15.4.4.14-3-28.js
test/built-ins/Array/prototype/indexOf/15.4.4.14-3-29.js

Example:

```
var targetObj = {};
var obj = {
  0: 42,
  length: 2 ** 32 - 1
};

[].indexOf.call(obj, 42); // 0

obj.length = 2 ** 32

[].indexOf.call(obj, 42); // -1
```
Comment 1 Alexey Shvayka 2020-04-03 09:46:29 PDT
Thank you for detailed report, Leo.
Apart from Array.prototype.indexOf, other Array methods (mostly ones that are implemented in C++) are affected.
I am merging bug reports to fix all (observable) cases with a single patch.

*** This bug has been marked as a duplicate of bug 163417 ***