From 67d52eb4f27b2056e181a77cbd8afa34c62d0d16 Mon Sep 17 00:00:00 2001 From: shrekshao Date: Tue, 29 Nov 2022 22:00:13 +0000 Subject: [PATCH] Fix stack-use-after-scope for usedInterstageVariables pointer Bug: chromium:1393728 Change-Id: I078f898b9a6a237c81c15bb86736eb790cf6a261 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/112260 Reviewed-by: Austin Eng Commit-Queue: Shrek Shao Kokoro: Kokoro --- src/dawn/native/d3d12/RenderPipelineD3D12.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/dawn/native/d3d12/RenderPipelineD3D12.cpp b/src/dawn/native/d3d12/RenderPipelineD3D12.cpp index 6c8a6fbeac..0a8532583f 100644 --- a/src/dawn/native/d3d12/RenderPipelineD3D12.cpp +++ b/src/dawn/native/d3d12/RenderPipelineD3D12.cpp @@ -358,11 +358,12 @@ MaybeError RenderPipeline::Initialize() { PerStage compiledShader; std::bitset* usedInterstageVariables = nullptr; + dawn::native::EntryPointMetadata fragmentEntryPoint; if (GetStageMask() & wgpu::ShaderStage::Fragment) { // Now that only fragment shader can have interstage inputs. const ProgrammableStage& programmableStage = GetStage(SingleShaderStage::Fragment); - auto entryPoint = programmableStage.module->GetEntryPoint(programmableStage.entryPoint); - usedInterstageVariables = &entryPoint.usedInterStageVariables; + fragmentEntryPoint = programmableStage.module->GetEntryPoint(programmableStage.entryPoint); + usedInterstageVariables = &fragmentEntryPoint.usedInterStageVariables; } for (auto stage : IterateStages(GetStageMask())) {