chakra-core / chakra-core/ChakraCore

A bug of ‘Array.prototype.sort'

Open
#6,362 1 comment 0 reactions 0 assignees View on GitHub
Bug
Dominant language
JavaScript
Stars
9.3k
Forks
1.2k
PR merge metrics
No merged PRs in 30d

Description

I run the following code in Characore-1.11.15 and get an odd output. The code firstly call the function ‘foo’, at this time, it print “false”. But then, when calling the ‘foo’ again in the ‘sort’, it print “true”. So I think a bug maybe exists in the implementation of ‘Array.prototype.sort’. This bug may affect the sort result.

The code:
```
var array = [21, 45, -12, 37, 0];
function foo() {
print(array<1048576);
}
foo();
arr2 = Array.prototype.sort.call(array, foo);
```

The output:
```
false
true
true
true
true
```

ISec Lab
2019.12.21

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.