diff options
| author | bunnei <bunneidev@gmail.com> | 2021-06-09 15:24:46 -0700 |
|---|---|---|
| committer | bunnei <bunneidev@gmail.com> | 2021-06-09 15:24:46 -0700 |
| commit | d06f7d9f6c0bb09112100e352f465450d9c56da4 (patch) | |
| tree | 39910198e1a7668a6cc15578bc2d7a15aab20b04 /src/core/hle/kernel/svc.cpp | |
| parent | 7b6da43bbff5ef4bb35e409db3bf21a25748c3bc (diff) | |
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.
Diffstat (limited to 'src/core/hle/kernel/svc.cpp')
| -rw-r--r-- | src/core/hle/kernel/svc.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index 28bcae6e74..8339e11a07 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/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(); |
