Skip to content

VERY experimental Nintendo Switch 2 emulator

C++

video_core: Fix benign out-of-bounds indexing of array (#2553)

Yuri Kunde Schlesneref90a662f2d6
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp
index c860375a1f..60c5b9ad5d 100644
--- a/src/video_core/shader/shader.cpp
+++ b/src/video_core/shader/shader.cpp
@@ -39,9 +39,8 @@ OutputVertex OutputVertex::FromAttributeBuffer(const RasterizerRegs& regs, Attri
for (unsigned comp = 0; comp < 4; ++comp) {
RasterizerRegs::VSOutputAttributes::Semantic semantic = semantics[comp];
- float24* out = &vertex_slots[semantic];
if (semantic < vertex_slots.size()) {
- *out = input.attr[i][comp];
+ vertex_slots[semantic] = input.attr[i][comp];
} else if (semantic != RasterizerRegs::VSOutputAttributes::INVALID) {
LOG_ERROR(HW_GPU, "Invalid/unknown semantic id: %u", (unsigned int)semantic);
}