Pārlūkot izejas kodu

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.
bunnei 5 gadi atpakaļ
vecāks
revīzija
c63ea608aa
1 mainītis faili ar 2 papildinājumiem un 2 dzēšanām
  1. 2 2
      src/core/hle/kernel/svc.cpp

+ 2 - 2
src/core/hle/kernel/svc.cpp

@@ -449,8 +449,8 @@ static ResultCode CancelSynchronization(Core::System& system, Handle handle) {
 
     // Get the thread from its handle.
     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.
     thread->WaitCancel();