Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASSERTION fails in Array.prototype.copyWithin #6458

Open
sunlili opened this issue Jun 8, 2020 · 1 comment
Open

ASSERTION fails in Array.prototype.copyWithin #6458

sunlili opened this issue Jun 8, 2020 · 1 comment

Comments

@sunlili
Copy link

@sunlili sunlili commented Jun 8, 2020

Hello,
I run following code in ch 1.11.19(debug),and it will crash by an assertion.

let b = [1.1, 2.2, 3.3];
b[4294967294] = 3;
Array.prototype.copyWithin.call(b, 0, 1);

Crash output:

ASSERTION 7690: (/.../ChakraCore-1.11.19/lib/Runtime/Library/JavascriptArray.cpp, line 9309) direction == -1 || (fromVal + count < MaxArrayLength && toVal + count < MaxArrayLength)
 Failure: (direction == -1 || (fromVal + count < MaxArrayLength && toVal + count < MaxArrayLength))
Illegal instruction

When reading the source code, I find that the if-condition and the asserts in else-branch are not mutually complemental.

|| (((fromVal + count) > MaxArrayLength) || ((toVal + count) > MaxArrayLength)))

The asserts in else-branch should be :
Assert((fromVal + count) <= MaxArrayLength && (toVal + count) <= MaxArrayLength )

ISec Lab
2020.6.8

@ppenzin
Copy link
Collaborator

@ppenzin ppenzin commented Jun 9, 2020

Thank you for the report, that is definitely a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.