diff options
author | Mary <mary@mary.zone> | 2023-01-05 01:55:27 +0100 |
---|---|---|
committer | Mary <mary@mary.zone> | 2023-01-05 01:55:27 +0100 |
commit | 86392455338e5e1fc65b25a3136d866228e28e40 (patch) | |
tree | e07a420e18a72279f46a38743daed59c7e3a4cb4 | |
parent | d6b86a6629aefdfea9b7e7d1dea92bba6b4e1481 (diff) |
hle: Add safety measure around overflow in ScheduleFutureInvocation1.1.510
Fix crash on Linux since 08831eecf77cedd3c4192ebab5a9c485fb15d51e.
-rw-r--r-- | Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs b/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs index 4eb736f2..020048f4 100644 --- a/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs +++ b/Ryujinx.HLE/HOS/Kernel/Common/KTimeManager.cs @@ -44,7 +44,13 @@ namespace Ryujinx.HLE.HOS.Kernel.Common public void ScheduleFutureInvocation(IKFutureSchedulerObject schedulerObj, long timeout) { - long timePoint = PerformanceCounter.ElapsedTicks + ConvertNanosecondsToHostTicks(timeout); + long startTime = PerformanceCounter.ElapsedTicks; + long timePoint = startTime + ConvertNanosecondsToHostTicks(timeout); + + if (timePoint < startTime) + { + timePoint = long.MaxValue; + } lock (_context.CriticalSection.Lock) { |