summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar Subv2018-11-30 16:06:49 -0500
committerGravatar Subv2018-11-30 16:06:49 -0500
commit583bd20f02fabb2b41f42d2ae8feb1994c0e4fb4 (patch)
treef1bafdba579c4f930828f51df717d56c62d3d7a8 /src
parentconfigure_input: Amend clang-format discrepancies (diff)
downloadyuzu-583bd20f02fabb2b41f42d2ae8feb1994c0e4fb4.tar.gz
yuzu-583bd20f02fabb2b41f42d2ae8feb1994c0e4fb4.tar.xz
yuzu-583bd20f02fabb2b41f42d2ae8feb1994c0e4fb4.zip
Services/VI: Dereferencing an uninitialized std::optional is undefined behavior.
Assert that it is not empty before using it in the DequeueBuffer wait callback.
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/service/vi/vi.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index 5120abfff..412d5b0c9 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -542,6 +542,8 @@ private:
542 // Repeat TransactParcel DequeueBuffer when a buffer is available 542 // Repeat TransactParcel DequeueBuffer when a buffer is available
543 auto buffer_queue = nv_flinger->GetBufferQueue(id); 543 auto buffer_queue = nv_flinger->GetBufferQueue(id);
544 std::optional<u32> slot = buffer_queue->DequeueBuffer(width, height); 544 std::optional<u32> slot = buffer_queue->DequeueBuffer(width, height);
545 ASSERT_MSG(slot != std::nullopt, "Could not dequeue buffer.");
546
545 IGBPDequeueBufferResponseParcel response{*slot}; 547 IGBPDequeueBufferResponseParcel response{*slot};
546 ctx.WriteBuffer(response.Serialize()); 548 ctx.WriteBuffer(response.Serialize());
547 IPC::ResponseBuilder rb{ctx, 2}; 549 IPC::ResponseBuilder rb{ctx, 2};