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 failure in JavascriptArray.cpp #6770

Open
zhunki opened this issue Dec 24, 2021 · 2 comments · May be fixed by #6846
Open

Assertion failure in JavascriptArray.cpp #6770

zhunki opened this issue Dec 24, 2021 · 2 comments · May be fixed by #6846

Comments

@zhunki
Copy link

zhunki commented Dec 24, 2021

the following poc cause a assertion failure in "debug" build on ubuntu.

function opt(){
	const v2 = [-1000000000.0];
	v2.length = 4294967295;
	const v3 = v2.copyWithin();
	return v3;
}


for(let i=0;i<0x200;i++){
	opt(false);
}
@ppenzin ppenzin added the Bug label Jan 31, 2022
@ppenzin
Copy link
Member

ppenzin commented Jan 31, 2022

I can see this failing, but want to check out something before I leave this and move to verifying other reports, this would only fail if the length is exactly equal to MaxArrayLength, I feel we might be off-by-one, there is the condition:

        if ((direction == -1 && (fromVal >= MaxArrayLength || toVal >= MaxArrayLength))
            || (((fromVal + count) > MaxArrayLength) || ((toVal + count) > MaxArrayLength)))
        {

https://github.com/chakra-core/ChakraCore/blob/master/lib/Runtime/Library/JavascriptArray.cpp#L9452-L9454

Which doesn't catch MaxArrayLength when direction is 1, but its else branch would trip an assert on just that.

@Arunav1
Copy link

Arunav1 commented Jan 16, 2024

Hey @zhunki can I be assigned this work in order to resolve this issue ?

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

Successfully merging a pull request may close this issue.

3 participants