Description

SetHitResultFromShapeAndFaceIndex calls 

 

if(PxMaterial* PxMat = PShape->getMaterialFromInternalFaceIndex(FaceIndex))
{
OutResult.PhysMaterial = FPhysxUserData::Get<UPhysicalMaterial>(PxMat->userData);
}

 

and in some cases PxMat is neither null nor valid, resulting in an access violation upon referencing.

 

This can occur when a mesh is missing a material slot and the portion of the mesh using the missing slot is traced against.

Steps to Reproduce

Place the attached mesh asset in a level and perform a complex trace against its larger area.

 

Callstack
Access violation - code c0000005 (first/second chance not available)

UE4Editor_Engine!SetHitResultFromShapeAndFaceIndex() [d:\builds\release-4.21\engine\source\runtime\engine\private\collision\collisionconversions.cpp:416]
UE4Editor_Engine!ConvertQueryImpactHit() [d:\builds\release-4.21\engine\source\runtime\engine\private\collision\collisionconversions.cpp:593]
UE4Editor_Engine!FPhysicsInterface_PhysX::RaycastSingle() [d:\builds\release-4.21\engine\source\runtime\engine\private\collision\physxcollision.cpp:258]
UE4Editor_Engine!UWorld::LineTraceSingleByChannel() [d:\builds\release-4.21\engine\source\runtime\engine\private\collision\worldcollision.cpp:79]
UE4Editor_Engine!UKismetSystemLibrary::LineTraceSingle() [d:\builds\release-4.21\engine\source\runtime\engine\private\kismetsystemlibrary.cpp:1335]
UE4Editor_Engine!UKismetSystemLibrary::execLineTraceSingle() [d:\builds\release-4.21\engine\source\runtime\engine\classes\kismet\kismetsystemlibrary.h:77]
UE4Editor_CoreUObject!UFunction::Invoke() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\class.cpp:4861]
UE4Editor_CoreUObject!UObject::CallFunction() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:816]
UE4Editor_CoreUObject!UObject::ProcessContextOpcode() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2330]
UE4Editor_CoreUObject!UObject::execLetBool() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:2232]
UE4Editor_CoreUObject!UObject::ProcessInternal() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1031]
UE4Editor_CoreUObject!UObject::CallFunction() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:940]
UE4Editor_CoreUObject!UObject::ProcessInternal() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1031]
UE4Editor_CoreUObject!UFunction::Invoke() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\class.cpp:4861]
UE4Editor_CoreUObject!UObject::ProcessEvent() [d:\builds\release-4.21\engine\source\runtime\coreuobject\private\uobject\scriptcore.cpp:1480]
UE4Editor_Engine!AActor::ProcessEvent() [d:\builds\release-4.21\engine\source\runtime\engine\private\actor.cpp:713]
UE4Editor_Engine!AActor::ReceiveTick() [d:\builds\release-4.21\engine\intermediate\build\win64\ue4editor\inc\engine\actor.gen.cpp:1040]
UE4Editor_Engine!AActor::Tick() [d:\builds\release-4.21\engine\source\runtime\engine\private\actor.cpp:934]
UE4Editor_Engine!AActor::TickActor() [d:\builds\release-4.21\engine\source\runtime\engine\private\actor.cpp:914]
UE4Editor_Engine!FActorTickFunction::ExecuteTick() [d:\builds\release-4.21\engine\source\runtime\engine\private\actor.cpp:137]
UE4Editor_Engine!TGraphTask<FTickFunctionTask>::ExecuteTask() [d:\builds\release-4.21\engine\source\runtime\core\public\async\taskgraphinterfaces.h:829]
UE4Editor_Core!FNamedTaskThread::ProcessTasksNamedThread() [d:\builds\release-4.21\engine\source\runtime\core\private\async\taskgraph.cpp:679]
UE4Editor_Core!FNamedTaskThread::ProcessTasksUntilQuit() [d:\builds\release-4.21\engine\source\runtime\core\private\async\taskgraph.cpp:575]
UE4Editor_Core!FTaskGraphImplementation::WaitUntilTasksComplete() [d:\builds\release-4.21\engine\source\runtime\core\private\async\taskgraph.cpp:1444]
UE4Editor_Engine!FTickTaskSequencer::ReleaseTickGroup() [d:\builds\release-4.21\engine\source\runtime\engine\private\ticktaskmanager.cpp:556]
UE4Editor_Engine!FTickTaskManager::RunTickGroup() [d:\builds\release-4.21\engine\source\runtime\engine\private\ticktaskmanager.cpp:1474]
UE4Editor_Engine!UWorld::RunTickGroup() [d:\builds\release-4.21\engine\source\runtime\engine\private\leveltick.cpp:783]
UE4Editor_Engine!UWorld::Tick() [d:\builds\release-4.21\engine\source\runtime\engine\private\leveltick.cpp:1460]
UE4Editor_UnrealEd!UEditorEngine::Tick() [d:\builds\release-4.21\engine\source\editor\unrealed\private\editorengine.cpp:1726]
UE4Editor_UnrealEd!UUnrealEdEngine::Tick() [d:\builds\release-4.21\engine\source\editor\unrealed\private\unrealedengine.cpp:403]
UE4Editor!FEngineLoop::Tick() [d:\builds\release-4.21\engine\source\runtime\launch\private\launchengineloop.cpp:3699]
UE4Editor!GuardedMain() [d:\builds\release-4.21\engine\source\runtime\launch\private\launch.cpp:174]
UE4Editor!GuardedMainWrapper() [d:\builds\release-4.21\engine\source\runtime\launch\private\windows\launchwindows.cpp:145]
UE4Editor!WinMain() [d:\builds\release-4.21\engine\source\runtime\launch\private\windows\launchwindows.cpp:276]
UE4Editor!__scrt_common_main_seh() [d:\agent\_work\1\s\src\vctools\crt\vcstartup\src\startup\exe_common.inl:288]
kernel32
ntdll

Have Comments or More Details?

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

6
Login to Vote

Won't Fix
ComponentUE - Simulation - Physics
Affects Versions4.21
Target Fix4.26
CreatedNov 15, 2019
ResolvedSep 11, 2020
UpdatedAug 9, 2021
Pull Requests
8288 - rtrick
View Jira Issue