Description

UEnhancedInputComponent::BindActionValue returns a reference to the action's value binding, and callers keep it to read the action's value later. The component stores its value bindings by value in a TArray:

  • Binding a new action can reallocate the array. Every kept reference then points to freed memory.
  • Removing a value binding shifts the later ones. A kept reference then reads another action's value.

Gameplay Cameras keeps these references:

  • FInputAxisBindingHelpers::BindActionValues, used by the Input Axis Binding 2D and Raw Input Axis Binding 2D camera nodes, keeps &BindActionValue(...) pointers.
  • FPlayerControlRotationEvaluationService::BindActionValues keeps them too.

Any later BindActionValue for another action on the same input component (Blueprint action value nodes, another camera node or rig, game code) can leave them dangling. The camera then reads garbage or another action's value. The nodes also keep using the old input component after the pawn gets a new one on possession.

How long it has existed: the TArray storage is from the first Enhanced Input release (CL 14009502, August 2020, UE 4.26), so a kept reference has been unsafe in every release. The camera code that keeps the references was added in July and August 2024 (CLs 34953109, 35646316, 43697178, 43700442) and ships in UE 5.5, 5.6, 5.7 and 5.8. Not a regression.

Steps to Reproduce
  1. Use a game module whose Build.cs lists EnhancedInput, for example a new project from the Third Person C++ template.
  2. Paste the code below into any .cpp file of that module, then build and open the editor.
  3. In the Output Log, run the console command Repro.EnhancedInput.ValueBindingReference.
// Paste into any .cpp file of a game module that depends on "EnhancedInput" (for example the Third Person C++ template),
// build, then run "Repro.EnhancedInput.ValueBindingReference" in the console. No content or input is needed.
#include "EnhancedInputComponent.h"
#include "HAL/IConsoleManager.h"
#include "InputAction.h"
#include "UObject/Package.h"

static FAutoConsoleCommand GReproValueBindingReferenceCommand(
	TEXT("Repro.EnhancedInput.ValueBindingReference"),
	TEXT("Checks that the reference BindActionValue returns stays valid after more actions are bound."),
	FConsoleCommandDelegate::CreateLambda([]()
	{
		UEnhancedInputComponent* InputComponent = NewObject<UEnhancedInputComponent>(GetTransientPackage());
		UInputAction* KeptAction = NewObject<UInputAction>(GetTransientPackage());

		// Keep the binding, the same way the Gameplay Cameras input axis nodes do.
		const FEnhancedInputActionValueBinding* KeptBinding = &InputComponent->BindActionValue(KeptAction);

		// Bind more actions, as Blueprint action value nodes, other camera nodes and game code do at runtime.
		for (int32 Index = 0; Index < 64; ++Index)
		{
			InputComponent->BindActionValue(NewObject<UInputAction>(GetTransientPackage()));
		}

		// BindActionValue returns the existing binding for an action that is already bound.
		const bool bKeptBindingIsValid = (&InputComponent->BindActionValue(KeptAction) == KeptBinding);
		UE_LOGF(LogTemp, Display, "Repro.EnhancedInput.ValueBindingReference: %s",
			bKeptBindingIsValid ? "PASS, the kept binding is still valid" : "BUG, the kept binding points to freed memory");
	}));

Expected result: the log shows Repro.EnhancedInput.ValueBindingReference: PASS, the kept binding is still valid.

Actual result: the log shows Repro.EnhancedInput.ValueBindingReference: BUG, the kept binding points to freed memory. Binding 64 more actions reallocated the value binding storage, so the reference that BindActionValue returned for the first action no longer points to its binding.

Notes:

  • The snippet compares addresses only and never reads through the stale pointer, so it does not crash. No content, mapping context or key input is needed.
  • Deterministic: 64 more bindings always reallocate the old TArray storage. The snippet compiles against the current engine. It was not run as a console command here; the automated test Input.Binding.ActionValueBindingSurvivesMoreBindings (EnhancedInputTests low-level tests) does the same check, failed on the old storage and passes with CL 60509184.
  • In game, the symptom is a Gameplay Cameras rig whose Input Axis Binding 2D or Raw Input Axis Binding 2D node, or the Player Control Rotation service, reads garbage or another action's value after other code binds more action values on the pawn's input component. That symptom comes from the UDN report and code reading; it was not reproduced in game here.

Have Comments or More Details?

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

0
Login to Vote

Fixed
Fix Commit61166807
CreatedNov 12, 2026
ResolvedNov 30, 2026
UpdatedDec 4, 2026
View Jira Issue