[5.9 Preview 2] Use-after-free of the post-process material pass name with r.RDG.Validation 0 (Development)

Summary

In Development builds with render graph validation off (r.RDG.Validation 0), the post-process material pass names itself from a temporary string, and the render pass reads that string after it has been freed. A packaged Win64 Development game crashes with an access violation in FRHICommandList::BeginRenderPass (wcslen).

FRDGEventName(const TCHAR*, ...) in RenderGraphEvent.cpp stores the format pointer and formats a copy of the name only when GRDGValidation != 0. PostProcessMaterial.cpp, under the #else of #if RDG_EVENTS != RDG_EVENTS_STRING_COPY (lines 714 and 941 at 5.9.0-preview-2), passes FRDGEventName(*Material->GetAssetName()). GetAssetName() returns an FString by value, which is destroyed at the end of the full expression. With validation off, the event keeps a dangling pointer, and BeginRenderPass reads it when the pass executes.

What Type of Bug are you experiencing?

Rendering (Graphics / Niagara)

Steps to Reproduce

Deterministic, in the editor, using the editor’s stomp allocator so the freed read faults at once:

  1. Start the game from the editor (-game) with -stomp2malloc -MallocStomp2MinSize=0 -MallocStomp2MaxSize=1 (the allocator starts idle).
  2. Have a post-process material active in the view (a post-process volume with any blendable material).
  3. Console: r.RDG.Validation 0
  4. Console: MallocStomp2.MinSize 16, then MallocStomp2.MaxSize 96 (routes 16 to 95 byte allocations through the allocator).

In a packaged Win64 Development game, steps 2 and 3 alone are enough. The crash comes sooner or later, depending on whether the freed block ends a page.

Expected Result

The game keeps rendering, as it does with r.RDG.Validation 1.

Observed Result

  • Editor with the stomp allocator: EXCEPTION_ACCESS_VIOLATION in ucrtbase / RenderCore on the next frame after step 4. GPU breadcrumb: PostProcessMaterial 1600x900 Material=DefaultPostProcessMaterial. The fault address is at page offset 0xFC0, where the allocator places a freed 54-byte block: that material name’s 26 characters plus the terminator, as UTF-16. Reproduced twice, with the same code addresses and offset both times.
  • Control: with r.RDG.Validation 1 and the same allocator window, no fault.
  • Control: with no post-process material in the view, a sweep of 16 to 511 byte windows with validation off faulted nowhere.
  • Packaged Win64 Development game, validation off: access violation in wcslen under FRHICommandList::BeginRenderPass, with a PostProcessMaterial breadcrumb naming our post-process material. This happened three times in one day, after 99 s, 11 min and 2 h of play.

Affects Versions

5.9

Platform(s)

Windows

For crash reports, include your callstack

ucrtbase!wcslen ← FRHICommandList::BeginRenderPass, during render graph execution of the post-process material pass.

Additional Notes

Seen on 5.9.0-preview-2 (commit 2f66b3f912, built from source). The same lines were in the 5.9 branch and ue5-main on 1 December 2026.

Suggested fix (we have not built an engine with it yet): name the pass with a literal format and the material name as an argument, which FRDGEventName keeps either way. At both call sites, replace

FRDGEventName(*Material->GetAssetName()),

with

RDG_EVENT_NAME("PostProcessMaterial %s", *Material->GetAssetName()),

With validation off, the pass is then named by the unformatted text. Copying the name in FRDGEventName when it is not a literal would also avoid it.

Shipping and Test are not affected: they compile the other side of the #if, and render graph debugging is off there. We reproduced this in our own project, not yet in a fresh template project; any project with an active post-process material should show it the same way.