From b10f3d96f566b36b32a65823e151f3cffe0afa64 Mon Sep 17 00:00:00 2001 From: Wunk Date: Fri, 3 Nov 2023 03:35:52 -0700 Subject: [PATCH] command_processor: Fix out-of-bounds float-uniform access (#7111) Addresses: https://github.com/citra-emu/citra/issues/6696 https://github.com/citra-emu/citra/issues/6871 --- src/video_core/command_processor.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/video_core/command_processor.cpp b/src/video_core/command_processor.cpp index c5094e4627..a6f2eb73f7 100644 --- a/src/video_core/command_processor.cpp +++ b/src/video_core/command_processor.cpp @@ -78,12 +78,11 @@ static void WriteUniformFloatReg(ShaderRegs& config, Shader::ShaderSetup& setup, (float_regs_counter >= 3 && !uniform_setup.IsFloat32())) { float_regs_counter = 0; - auto& uniform = setup.uniforms.f[uniform_setup.index]; - - if (uniform_setup.index >= 96) { + if (uniform_setup.index >= setup.uniforms.f.size()) { LOG_ERROR(HW_GPU, "Invalid {} float uniform index {}", GetShaderSetupTypeName(setup), (int)uniform_setup.index); } else { + auto& uniform = setup.uniforms.f[uniform_setup.index]; // NOTE: The destination component order indeed is "backwards" if (uniform_setup.IsFloat32()) {