From 672665dec001edae90fd1dcfdc94a0a54585c4bf Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 1 Apr 2018 19:01:55 -0400 Subject: [PATCH] AsyncRequests: In-class initialize class members Prior to this change, it's possible for m_wake_me_up_again to be used while it's in an uninitialized state from the exposed API. e.g. - Using SetEnable after construction would perform an uninitialized read. - Using PushEvent would perform an uninitialized read by way of operator |=. internally, an uninitialized read can happen if PullEventsInternal() is executed before other functions. Just to avoid the whole possibility of performing uninitialized reads, we just give the class member a default value of false. --- Source/Core/VideoCommon/AsyncRequests.cpp | 4 +--- Source/Core/VideoCommon/AsyncRequests.h | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Source/Core/VideoCommon/AsyncRequests.cpp b/Source/Core/VideoCommon/AsyncRequests.cpp index f41354730d..cab79c8bc2 100644 --- a/Source/Core/VideoCommon/AsyncRequests.cpp +++ b/Source/Core/VideoCommon/AsyncRequests.cpp @@ -12,9 +12,7 @@ AsyncRequests AsyncRequests::s_singleton; -AsyncRequests::AsyncRequests() : m_enable(false), m_passthrough(true) -{ -} +AsyncRequests::AsyncRequests() = default; void AsyncRequests::PullEventsInternal() { diff --git a/Source/Core/VideoCommon/AsyncRequests.h b/Source/Core/VideoCommon/AsyncRequests.h index c898c86c62..4c22d388e3 100644 --- a/Source/Core/VideoCommon/AsyncRequests.h +++ b/Source/Core/VideoCommon/AsyncRequests.h @@ -90,9 +90,9 @@ private: std::mutex m_mutex; std::condition_variable m_cond; - bool m_wake_me_up_again; - bool m_enable; - bool m_passthrough; + bool m_wake_me_up_again = false; + bool m_enable = false; + bool m_passthrough = true; std::vector m_merged_efb_pokes; };