Browse Source

kernel: svc: Add missing error check to CancelSynchronization.

- Avoids a potential crash if the handle is invalid, and also makes this code accurate to real kernel behavior.
nce_cpp
bunnei 5 years ago
parent
commit
d06f7d9f6c
  1. 4
      src/core/hle/kernel/svc.cpp

4
src/core/hle/kernel/svc.cpp

@ -449,8 +449,8 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) {
// Get the thread from its handle. // Get the thread from its handle.
KScopedAutoObject thread = KScopedAutoObject thread =
system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(
static_cast<Handle>(handle));
system.Kernel().CurrentProcess()->GetHandleTable().GetObject<KThread>(handle);
R_UNLESS(thread.IsNotNull(), ResultInvalidHandle);
// Cancel the thread's wait. // Cancel the thread's wait.
thread->WaitCancel(); thread->WaitCancel();

Loading…
Cancel
Save