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

Fix assertion failure in JavascriptArray.cpp #6846

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 2 additions & 3 deletions lib/Runtime/Library/JavascriptArray.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9402,9 +9402,8 @@ using namespace Js;
}
else
{
Assert(fromVal < MaxArrayLength);
Assert(toVal < MaxArrayLength);
Assert(direction == -1 || (fromVal + count < MaxArrayLength && toVal + count < MaxArrayLength));
Assert(direction != -1 || (fromVal < MaxArrayLength && toVal < MaxArrayLength));
Assert(fromVal + count <= MaxArrayLength && toVal + count <= MaxArrayLength);
ShortDevelopment marked this conversation as resolved.
Show resolved Hide resolved

uint32 fromIndex = static_cast<uint32>(fromVal);
uint32 toIndex = static_cast<uint32>(toVal);
Expand Down
20 changes: 20 additions & 0 deletions test/es6/ES6ArrayAPI_slow.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Copyright (c) ChakraCore Project Contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------

WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js");

const uint32Max = 4294967295;
const tests = [
{
name: "Issue #6770 (Assertion failure in copyWithin)",
body() {
const array = [];
array.length = uint32Max;
array.copyWithin();
}
}
];
testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });
7 changes: 7 additions & 0 deletions test/es6/rlexe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,13 @@
<compile-flags>-ES6ObjectLiterals -args summary -endargs</compile-flags>
</default>
</test>
<test>
<default>
<files>ES6ArrayAPI_slow.js</files>
<compile-flags>-ES6ObjectLiterals -args summary -endargs</compile-flags>
<tags>Slow</tags>
</default>
</test>
<test>
<default>
<files>ES6ArrayUseConstructor.js</files>
Expand Down