summaryrefslogtreecommitdiffstats
path: root/src/core
diff options
context:
space:
mode:
authorMorph <39850852+Morph1984@users.noreply.github.com>2023-03-08 04:42:32 +0100
committerGitHub <noreply@github.com>2023-03-08 04:42:32 +0100
commita3ffea6a646ac1945ac7f01d401c7ae7b670b5a8 (patch)
tree26997bf1cf3b42d8e187923278357c8d774b5d0c /src/core
parentMerge pull request #9920 from liamwhite/constexpr-bit-cast (diff)
parentkernel: avoid signed overflow UB on MSVC (diff)
downloadyuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.tar
yuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.tar.gz
yuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.tar.bz2
yuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.tar.lz
yuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.tar.xz
yuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.tar.zst
yuzu-a3ffea6a646ac1945ac7f01d401c7ae7b670b5a8.zip
Diffstat (limited to '')
-rw-r--r--src/core/hle/kernel/k_resource_limit.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/core/hle/kernel/k_resource_limit.cpp b/src/core/hle/kernel/k_resource_limit.cpp
index b9d22b414..626517619 100644
--- a/src/core/hle/kernel/k_resource_limit.cpp
+++ b/src/core/hle/kernel/k_resource_limit.cpp
@@ -2,6 +2,7 @@
// SPDX-License-Identifier: GPL-2.0-or-later
#include "common/assert.h"
+#include "common/overflow.h"
#include "core/core.h"
#include "core/core_timing.h"
#include "core/hle/kernel/k_resource_limit.h"
@@ -104,7 +105,7 @@ bool KResourceLimit::Reserve(LimitableResource which, s64 value, s64 timeout) {
ASSERT(current_hints[index] <= current_values[index]);
// If we would overflow, don't allow to succeed.
- if (current_values[index] + value <= current_values[index]) {
+ if (Common::WrappingAdd(current_values[index], value) <= current_values[index]) {
break;
}