Wrong begin lookup segment in JavascriptArray::DirectSetItem_Full
In the function JavascriptArray::DirectSetItem_Full (JavaScriptArray.inl):
//Find the segment where itemIndex is present or is at the boundary
SparseArraySegment
Here it tries to use GetBeginLookupSegment to speed up the search. However, in the following statement:
if (current->left + current->size > current->left || itemIndex >= current->left + current->size)
{
current = SparseArraySegment
Here current->left + current->size > current->left is always true for a normal segment, so it will always execute:
current = SparseArraySegment
I think this is a typo here, it should be:
if (current->left + current->size < current->left || itemIndex >= current->left + current->size)
Great catch, thanks for reporting! I see two instances of that same logic in DirectSetItem_Full.
@guhe120 nice find. Although when I look more this current->left + current->size > current->left
should be current->left > itemIndex , no?
This current->left + current->size < current->left would always returns false. As we must have established that left+size will not overlfow when we have created segment.