Skip to content

[UE] Bug: Mixin创建出的UFunction成员PropertiesSize为0,导致ProcessEvent时崩溃 #1947

Open
@parnny

Description

前置阅读 | Pre-reading

Puer的版本 | Puer Version

master,lastest

UE的版本 | UE Version

5.4.4

发生在哪个平台 | Platform

Editor(win)

错误信息 | Error Message

ScriptCore.cpp

if (!bUsePersistentFrame)
{
	Frame = (uint8*)UE_VSTACK_ALLOC_ALIGNED(VirtualStackAllocator, Function->PropertiesSize, Function->GetMinAlignment());
	// zero the local property memory
	const int32 NonParmsPropertiesSize = Function->PropertiesSize - Function->ParmsSize;
	if (NonParmsPropertiesSize)
	{
		FMemory::Memzero(Frame + Function->ParmsSize, NonParmsPropertiesSize);
	}
}

Function->PropertiesSize为0, Function->ParmsSize为16, 导致Memzero崩溃

JSGeneratedClass.cpp

  if (!Existed)
  {
      UFunction* Tmp =
          Cast<UFunction>(StaticDuplicateObject(Super, Class, Super->GetFName(), RF_AllFlags, UFunction::StaticClass()));
      Tmp->SetSuperStruct(Super);
      Tmp->Next = Class->Children;
      Class->Children = Tmp;
      Class->AddFunctionToFunctionMap(Tmp, Tmp->GetFName());
      Tmp->SetFlags(Tmp->GetFlags() | RF_Transient);
      Super = Tmp;
  }

此处通过StaticDuplicateObject复制出的Tmp,PropertiesSize、MinAlignment、Script数据与Super均有区别

问题重现 | Bug reproduce

Metadata

Assignees

Labels

UnrealbugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions