diff options
| author | 2017-02-10 20:51:09 -0800 | |
|---|---|---|
| committer | 2017-02-10 20:51:09 -0800 | |
| commit | e2fa1ca5e102bc4187d494dc11f202d93495de59 (patch) | |
| tree | 16c2ba1fddc3cb6cd6548d08dc65aa56b3b5da09 /src/video_core/shader/shader.cpp | |
| parent | Merge pull request #2482 from yuriks/pica-refactor (diff) | |
| download | yuzu-e2fa1ca5e102bc4187d494dc11f202d93495de59.tar.gz yuzu-e2fa1ca5e102bc4187d494dc11f202d93495de59.tar.xz yuzu-e2fa1ca5e102bc4187d494dc11f202d93495de59.zip | |
video_core: Fix benign out-of-bounds indexing of array (#2553)
The resulting pointer wasn't written to unless the index was verified as
valid, but that's still UB and triggered debug checks in MSVC.
Reported by garrettboast on IRC
Diffstat (limited to 'src/video_core/shader/shader.cpp')
| -rw-r--r-- | src/video_core/shader/shader.cpp | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/video_core/shader/shader.cpp b/src/video_core/shader/shader.cpp index c860375a1..60c5b9ad5 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 | |||
| 39 | 39 | ||
| 40 | for (unsigned comp = 0; comp < 4; ++comp) { | 40 | for (unsigned comp = 0; comp < 4; ++comp) { |
| 41 | RasterizerRegs::VSOutputAttributes::Semantic semantic = semantics[comp]; | 41 | RasterizerRegs::VSOutputAttributes::Semantic semantic = semantics[comp]; |
| 42 | float24* out = &vertex_slots[semantic]; | ||
| 43 | if (semantic < vertex_slots.size()) { | 42 | if (semantic < vertex_slots.size()) { |
| 44 | *out = input.attr[i][comp]; | 43 | vertex_slots[semantic] = input.attr[i][comp]; |
| 45 | } else if (semantic != RasterizerRegs::VSOutputAttributes::INVALID) { | 44 | } else if (semantic != RasterizerRegs::VSOutputAttributes::INVALID) { |
| 46 | LOG_ERROR(HW_GPU, "Invalid/unknown semantic id: %u", (unsigned int)semantic); | 45 | LOG_ERROR(HW_GPU, "Invalid/unknown semantic id: %u", (unsigned int)semantic); |
| 47 | } | 46 | } |