Description

There is a crash when changing the value type of a MapProperty to something else that provides a ConvertFromType handler. The backward compatible loading code is not correct for map properties and ends up corrupting memory. This crash can manifest with a few different stacks, all involve MapProperty::SerializeItem or MapProperty::ConvertFromType

Steps to Reproduce

1. Open up any project
2. Create a new blueprint ParentBlueprint, add a new variable of type Map which maps from any enum to a Texture2d Object Reference. Compile and save
3. Create a child blueprint of that ChildBlueprint, modify defaults to add something to the map. Make sure the texture reference is valid (you may need to enable engine content). Compile and Save
4. Close and reopen project.
5. Open ParentBlueprint only. Change the value type of the map to a Texture2d Soft Object Reference. Compile and save,
6. Open ChildBlueprint, editor will crash reading the old data

Callstack

> UE4Editor-Core.dll!FGenericPlatformMemory::OnOutOfMemory(unsigned __int64 Size, unsigned int Alignment) Line 174 C++
UE4Editor-Core.dll!FMallocTBB::Realloc(void * Ptr, unsigned __int64 NewSize, unsigned int Alignment) Line 120 C++
UE4Editor-Core.dll!FMemory::Realloc(void * Original, unsigned __int64 Count, unsigned int Alignment) Line 48 C++
UE4Editor-Core.dll!TArray<wchar_t,FDefaultAllocator>::ResizeForCopy(int NewMax, int PrevMax) Line 2262 C++
UE4Editor-Core.dll!FString::FString(const FString & __that) Line 1731 C++
UE4Editor-CoreUObject.dll!FStringAssetReference::operator=(const FStringAssetReference & Other) Line 120 C++
UE4Editor-CoreUObject.dll!UAssetObjectProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 51 C++
UE4Editor-CoreUObject.dll!UMapProperty::SerializeItem(FArchive & Ar, void * Value, const void * Defaults) Line 427 C++
UE4Editor-CoreUObject.dll!UStruct::SerializeBin(FArchive & Ar, void * Data) Line 835 C++
UE4Editor-CoreUObject.dll!UObject::SerializeScriptProperties(FArchive & Ar) Line 1299 C++

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Gameplay - Blueprint
Affects Versions4.164.17
Target Fix4.17
Fix Commit3540214
Main Commit3596628
Release Commit3540214
CreatedJul 17, 2017
ResolvedJul 17, 2017
UpdatedApr 27, 2018
View Jira Issue