Explorar o código

Timers: Return an error when calling SetTimer with negative timeouts.

Subv %!s(int64=9) %!d(string=hai) anos
pai
achega
0be77c3ae4
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      src/core/hle/svc.cpp

+ 5 - 0
src/core/hle/svc.cpp

@@ -837,6 +837,11 @@ static ResultCode SetTimer(Kernel::Handle handle, s64 initial, s64 interval) {
 
     LOG_TRACE(Kernel_SVC, "called timer=0x%08X", handle);
 
+    if (initial < 0 || interval < 0) {
+        return ResultCode(ErrorDescription::OutOfRange, ErrorModule::Kernel,
+                          ErrorSummary::InvalidArgument, ErrorLevel::Permanent);
+    }
+
     SharedPtr<Timer> timer = Kernel::g_handle_table.Get<Timer>(handle);
     if (timer == nullptr)
         return ERR_INVALID_HANDLE;