aboutsummaryrefslogtreecommitdiff
path: root/Ryujinx.Memory/Range/MemoryRange.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Ryujinx.Memory/Range/MemoryRange.cs')
-rw-r--r--Ryujinx.Memory/Range/MemoryRange.cs7
1 files changed, 7 insertions, 0 deletions
diff --git a/Ryujinx.Memory/Range/MemoryRange.cs b/Ryujinx.Memory/Range/MemoryRange.cs
index ba12bae5..33d2439f 100644
--- a/Ryujinx.Memory/Range/MemoryRange.cs
+++ b/Ryujinx.Memory/Range/MemoryRange.cs
@@ -50,6 +50,13 @@ namespace Ryujinx.Memory.Range
ulong otherAddress = other.Address;
ulong otherEndAddress = other.EndAddress;
+ // If any of the ranges if invalid (address + size overflows),
+ // then they are never considered to overlap.
+ if (thisEndAddress < thisAddress || otherEndAddress < otherAddress)
+ {
+ return false;
+ }
+
return thisAddress < otherEndAddress && otherAddress < thisEndAddress;
}