@@ -11901,15 +11901,16 @@ using namespace Js;
11901
11901
SparseArraySegment<typename T::TElement>* src = SparseArraySegment<typename T::TElement>::From(instance->head);
11902
11902
SparseArraySegment<typename T::TElement>* dst;
11903
11903
11904
+ uint32 sourceSize = src->size;
11904
11905
if (IsInlineSegment(src, instance))
11905
11906
{
11906
- Assert(src->size <= SparseArraySegmentBase::INLINE_CHUNK_SIZE);
11907
-
11908
11907
// Copy head segment data between inlined head segments
11909
11908
dst = DetermineInlineHeadSegmentPointer<T, 0, true>(static_cast<T*>(this));
11910
11909
dst->left = src->left;
11911
11910
dst->length = src->length;
11912
- dst->size = src->size;
11911
+ uint inlineChunkSize = SparseArraySegmentBase::INLINE_CHUNK_SIZE;
11912
+ dst->size = min(src->size, inlineChunkSize);
11913
+ sourceSize = dst->size;
11913
11914
}
11914
11915
else
11915
11916
{
@@ -11922,9 +11923,9 @@ using namespace Js;
11922
11923
SetHeadAndLastUsedSegment(dst);
11923
11924
dst->CheckLengthvsSize();
11924
11925
11925
- Assert(IsInlineSegment(src, instance) == IsInlineSegment(dst, static_cast<T*>(this)));
11926
+ Assert(! IsInlineSegment(src, instance) || IsInlineSegment(dst, static_cast<T*>(this)));
11926
11927
11927
- CopyArray(dst->elements, dst->size, src->elements, src->size );
11928
+ CopyArray(dst->elements, dst->size, src->elements, sourceSize );
11928
11929
11929
11930
if (!deepCopy)
11930
11931
{
0 commit comments