Explorar o código

hle: kernel: KClientPort: Add an assert for session count.

- Prevents us from over decrementing num_sessions.
bunnei %!s(int64=5) %!d(string=hai) anos
pai
achega
b259e95c09
Modificáronse 1 ficheiros con 3 adicións e 0 borrados
  1. 3 0
      src/core/hle/kernel/k_client_port.cpp

+ 3 - 0
src/core/hle/kernel/k_client_port.cpp

@@ -28,6 +28,9 @@ void KClientPort::Initialize(KPort* parent_port_, s32 max_sessions_, std::string
 void KClientPort::OnSessionFinalized() {
     KScopedSchedulerLock sl{kernel};
 
+    // This might happen if a session was improperly used with this port.
+    ASSERT_MSG(num_sessions > 0, "num_sessions is invalid");
+
     const auto prev = num_sessions--;
     if (prev == max_sessions) {
         this->NotifyAvailable();