From 59a4ed0d2477999e979373eb821f024bf0d9d4c6 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Mon, 3 Dec 2018 22:50:16 -0500 Subject: kernel/object: Amend handle types to distinguish between readable and writable events Two kernel object should absolutely never have the same handle ID type. This can cause incorrect behavior when it comes to retrieving object types from the handle table. In this case it allows converting a WritableEvent into a ReadableEvent and vice-versa, which is undefined behavior, since the object types are not the same. This also corrects ClearEvent() to check both kernel types like the kernel itself does. --- src/core/hle/kernel/object.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/core/hle/kernel/object.cpp') diff --git a/src/core/hle/kernel/object.cpp b/src/core/hle/kernel/object.cpp index d87a62bb93..bb1b687786 100644 --- a/src/core/hle/kernel/object.cpp +++ b/src/core/hle/kernel/object.cpp @@ -13,7 +13,7 @@ Object::~Object() = default; bool Object::IsWaitable() const { switch (GetHandleType()) { - case HandleType::Event: + case HandleType::ReadableEvent: case HandleType::Thread: case HandleType::Timer: case HandleType::ServerPort: @@ -21,6 +21,7 @@ bool Object::IsWaitable() const { return true; case HandleType::Unknown: + case HandleType::WritableEvent: case HandleType::SharedMemory: case HandleType::Process: case HandleType::AddressArbiter: -- cgit v1.2.3