The Wayback Machine - https://web.archive.org/web/20220408174024/https://github.com/chakra-core/ChakraCore/issues/6770
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 · 1 comment
Open

Assertion failure in JavascriptArray.cpp #6770

zhunki opened this issue Dec 24, 2021 · 1 comment

Comments

@zhunki
Copy link

@zhunki 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 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.

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

No branches or pull requests

2 participants