Description

FCDODiffControl doesn't properly account for lists of differing size.
The issues are marked in the following code:

int IterOld = 0;
int IterNew = 0;
while (IterOld != OldProperties.Num() || IterNew != NewProperties.Num())
{
    ...
    else
    {
        if (IterOld != OldProperties.Num())
        {
            bool bFoundDifference = false;
            if (const FSingleObjectDiffEntry* OldDiffering = FindDiffering(DifferingProperties, OldProperties[IterOld]))
            {
                bFoundDifference = true;
                ...
            }
            else if (IterNew != NewProperties.Num())
            {
                if (const FSingleObjectDiffEntry* NewDiffering = FindDiffering(DifferingProperties, NewProperties[IterNew]))
                {
                    bFoundDifference = true;
                    ...
                }
            }
            
            // !!!! This will be hit if the first check fails (no diff from OlderProperties)
            // !!!! and IterNew == NewProperties.Num()
            // !!!! It causes IterNew to be incremented, meaning IterNew != NewProperties.Num() anymore;
            if (!bFoundDifference)
            {
                ++IterOld;
                ++IterNew;
            }
        }
        else
        {
            // !!!! This check is missed (because IterNew > NewProperties.Num())
            check(IterNew != NewProperties.Num());
            
            // !!!! Error is thrown for array index out of bounds.
            if (const FSingleObjectDiffEntry* Differing = FindDiffering(DifferingProperties, NewProperties[IterNew]))
            {
                OrderedProperties.Push(Differing);
            }
            ++IterNew;
        }
    }
}

One approach may be to do checks of < instead of !=.

Steps to Reproduce

TODO

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-36263 in the post.

0
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint
Affects Versions4.134.14
Target Fix4.14
Fix Commit3134965
Main Commit3152997
Release Commit3159180
CreatedSep 21, 2016
ResolvedSep 21, 2016
UpdatedApr 27, 2018
View Jira Issue