Description

Summary

Render-thread use-after-free in MeshPaintVirtualTexture::GetTextureDescriptor when changing scalability settings (e.g. applying the Low preset) in a world with mesh-painted FastGeo static meshes. The FTextureResource* passed in points to freed memory.

Suspected cause

  1. CL 53583433 added FStaticMeshSceneProxyDesc::CachedMeshPaintTextureResource, a raw FTextureResource* captured on the game thread in FFastGeoStaticMeshComponentBase::InitializeDynamicProperties (and refreshed in the OnResourceUpdated lambda). It was added so FastGeo's async render-state worker doesn't call UTexture::GetResource() from an unknown thread.
  2. FStaticMeshSceneProxy (and Nanite::FSceneProxy) copy that pointer in the constructor via GetMeshPaintTextureResource() and dereference it later on the render thread in CreateRenderThreadResources -> GetTextureDescriptor.
  3. Scalability presets change r.VT.MaxAnisotropy (e.g. 8 -> 4 in BaseScalability.ini). The VirtualTextureScalability.cpp console variable sink then calls VirtualTexture::Recreate(), which calls UpdateResource() on every virtual-textured UTexture, including UMeshPaintVirtualTexture.
  4. UTexture::ReleaseResource() deletes the old resource immediately inside a DeleteResource render command (not deferred). Any proxy that captured the old pointer and runs CreateRenderThreadResources after that command reads freed memory. This can happen either through a stale cache or through ordering between FRenderThreadCommandPipe work and the regular render command queue during the same CallAllConsoleVariableSinks.

FlushRenderingCommands / render fences on the game thread do not help, because the pointer is already stale when the add-primitive work is queued.

Possible fix

  • Stop carrying a raw FTextureResource* across threads. The proxy stores the UTexture* (only if IsCurrentlyVirtualTextured()), and CreateRenderThreadResources resolves MeshPaintTexture->GetResource() on the render thread. That returns PrivateResourceRenderThread, which only changes in render commands, so it is always valid or null at that point.
  • Apply to both FStaticMeshSceneProxy and Nanite::FSceneProxy.
  • Remove CachedMeshPaintTextureResource and the cache writes in FFastGeoStaticMeshComponentBase::InitializeDynamicProperties. Keep the OnResourceUpdated -> MarkRenderStateDirty binding so proxies are rebuilt after a recreate.
  • To verify: CreateRenderThreadResources must always run on a rendering thread (including the render command pipe path), and the FastGeo desc's UTexture must stay referenced for GC.
Steps to Reproduce
  1. Use a UE 5.8 project with FastGeo streaming and static meshes that use mesh paint virtual textures (UMeshPaintVirtualTexture).
  2. Launch the game (cooked/packaged) with a higher scalability preset (e.g. High/Epic).
  3. Travel to an area of the map where mesh-painted FastGeo static meshes are loaded (licensee: 'a certain part of the game').
  4. Open the video settings and change the overall settings preset to Low (sets all scalability groups to Low), then apply (UGameUserSettings::ApplyNonResolutionSettings).
  5. Result: crash on the render thread in MeshPaintVirtualTexture::GetTextureDescriptor (called from FStaticMeshSceneProxy::CreateRenderThreadResources) with a freed FTextureResource*.
  6. Expected: scalability change applies without crashing.
  7. Notes: content dependent, not easily reproduced. Shortcut that should trigger the same path: change r.VT.MaxAnisotropy at runtime while mesh-painted FastGeo meshes are loaded; running with a stomp allocator / ASan should make the use-after-free fail reliably. Log should show 'Recreating virtual texture pools.' just before the crash.
Callstack

Render thread (crash):

MeshPaintVirtualTexture::GetTextureDescriptor(FTextureResource*, uint32)
FStaticMeshSceneProxy::CreateRenderThreadResources(FRHICommandListBase&)
FScene::BatchAddPrimitivesInternal::<lambda_1>
FRenderThreadCommandPipe::ExecuteCommands / EnqueueAndLaunch
RenderingThreadMain

Game thread (same moment):

FScene::BatchAddPrimitivesInternal<FPrimitiveSceneDesc>
FScene::AddPrimitive
FFastGeoPrimitiveComponent::CreateRenderState
FComponentRecreateRenderStateContext::~FComponentRecreateRenderStateContext
FGlobalComponentRecreateRenderStateContext::~FGlobalComponentRecreateRenderStateContext
ScalabilityCVarsSinkCallback
RefreshEngineSettings
FConsoleManager::CallAllConsoleVariableSinks
UGameUserSettings::ApplyNonResolutionSettings

Have Comments or More Details?

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

0
Login to Vote

Fixed
ComponentUE - Engine Scaling - Streaming
Affects Versions5.8
Target Fix6.0
Fix Commit60377124
CreatedNov 3, 2026
ResolvedNov 9, 2026
UpdatedDec 3, 2026
View Jira Issue