Description

We likely have several places in the editor that convert text taken from an editable text into an FName without ensuring that the string will fit into an FName. This can lead to editor crashes.

One simply way to fix this would be to swap out the check in FName::InitInternal with something that truncates the name, eg)

TCharType TruncatedBuffer[NAME_SIZE];
if (!ensureMsgf(TCString<TCharType>::Strlen(InName)<=NAME_SIZE, TEXT("The given FName is %d characters and will be truncated to NAME_SIZE (%d) characters"), TCString<TCharType>::Strlen(InName), NAME_SIZE))
{
	TCString<TCharType>::Strncpy(TruncatedBuffer, InName, NAME_SIZE);
	InName = TruncatedBuffer;
}

Another way would be to create an editable text widget that's tailored to editing FNames, and which provides basic validation for length and invalid characters. This could then be used in places where we're editing an FName.

Have Comments or More Details?

Head over to the existing Questions & Answers thread and let us know what's up.

0
Login to Vote

Fixed
ComponentTools
Affects Versions4.74.8
Target Fix4.9
Fix Commit2531768
CreatedApr 29, 2015
ResolvedAug 6, 2015
UpdatedFeb 4, 2019