We are seeing an issue that seems to be the same as this ticket, as they have similar reproduction and identical callstacks: Unreal Engine Issues and Bug Tracker (UE\-252265)
When searching in the Content Browser, certain letters will crash the editor. Like the linked issue, these letters correspond to character in a Collection name, though they are not the full name. The crash will happen even with a single character being searched.
“Exception thrown at 0x00007FFAC8B3E42C (vcruntime140.dll) in UnrealEditor.exe: 0xC0000005: Access violation reading location 0x0000000000000000.”
The error occurs in TextFilterInternal::CompareStrings, but the issue seems to be earlier in the callstack, in FCompiledAssetTextFilter::PassesFilter, when checking Collections
`if (CollectionManager && bIncludeCollectionNames)
{
…
for (const FCollectionNameType& DynamicCollection : *ReferencedDynamicCollections)
{
bool bPassesCollectionFilter = false;
CollectionManager->TestDynamicQuery(
DynamicCollection.Name, DynamicCollection.Type, *this, bPassesCollectionFilter);
if (bPassesCollectionFilter)
{
AssetCollectionNames.AddUnique(DynamicCollection.Name);
}
}
}
}
}
// Convert entire text buffer to uppercase
// Assumes that for a TCHAR buffer this won’t change number of code points
TextBuffer.ToUpperInline();
const TCHAR* Cursor = *TextBuffer;
AssetDisplayName = FStringView(Cursor, DisplayNameLen);
Cursor += DisplayNameLen;
AssetFullPath = FStringView(Cursor, AssetPathLen);
Cursor += AssetPathLen;
AssetExportTextPath = FStringView(Cursor, ExportTextPathLen);
AssetExportTextPath.TrimStartAndEndInline(); // Backends try to separate export text paths with newlines
Cursor += ExportTextPathLen;`
The lower code sets three variables, AssetDisplayName, AssetFullPath, and AssetExportPath. The above code,
CollectionManager->TestDynamicQuery( DynamicCollection.Name, DynamicCollection.Type, *this, bPassesCollectionFilter);
uses those variables by eventually calling TestBasicStringExpression on the Context that is passed around. The variables are not set yet. The eventual string compare crashes.
My fix is to simply move the lower section of the code, where those three variables are set, to be above the Collection code. The only side effect I can see is that TextBuffer would get Uppercased. I don’t think the Collection code cares about that, but I don’t know for sure.
Is this a reasonable fix? Is there a better one? We see this area of code has changed in future versions, but we are not on those versions.