Skip to content

Commit 876e84f

Browse files
committed
Memset with native float arrays needs to check the type of the source because we can do nativearray[i] = var and bailout after the fact if the source was not a float (ie: changes the type of array).
Since memset will not change the type of the array, it needs to check before hand that the source is actually a float or int and bailout if not.
1 parent f7c5dbb commit 876e84f

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

lib/Runtime/Language/JavascriptOperators.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4689,6 +4689,11 @@ namespace Js
46894689
}
46904690
else
46914691
{
4692+
// For native float arrays, the jit doesn't check the type of the source so we have to do it here
4693+
if (!JavascriptNumber::Is(value) && !TaggedNumber::Is(value))
4694+
{
4695+
return false;
4696+
}
46924697
returnValue = JavascriptArray::FromVar(instance)->DirectSetItemAtRange<double>(start, length, JavascriptConversion::ToNumber(value, scriptContext));
46934698
}
46944699
returnValue &= vt == VirtualTableInfoBase::GetVirtualTable(instance);

0 commit comments

Comments
 (0)