From 8963947f0f22f2917fde11a71fa8be062ab1e8fa Mon Sep 17 00:00:00 2001 From: gdkchan Date: Tue, 14 Aug 2018 13:34:14 -0300 Subject: [PATCH] Check for invalid ids --- Ryujinx.HLE/OsHle/SystemState/UserId.cs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Ryujinx.HLE/OsHle/SystemState/UserId.cs b/Ryujinx.HLE/OsHle/SystemState/UserId.cs index f186d00c21..278ea9f772 100644 --- a/Ryujinx.HLE/OsHle/SystemState/UserId.cs +++ b/Ryujinx.HLE/OsHle/SystemState/UserId.cs @@ -13,6 +13,11 @@ namespace Ryujinx.HLE.OsHle.SystemState public UserId(long Low, long High) { + if ((Low | High) == 0) + { + throw new ArgumentException("Zero is not a valid user id!"); + } + byte[] Bytes = new byte[16]; int Index = Bytes.Length; @@ -42,7 +47,12 @@ namespace Ryujinx.HLE.OsHle.SystemState { if (UserIdHex == null || UserIdHex.Length != 32 || !UserIdHex.All("0123456789abcdefABCDEF".Contains)) { - throw new ArgumentException("UserId is not a valid Hex string", nameof(UserIdHex)); + throw new ArgumentException("Invalid user id!", nameof(UserIdHex)); + } + + if (UserIdHex == "00000000000000000000000000000000") + { + throw new ArgumentException("Zero is not a valid user id!", nameof(UserIdHex)); } this.UserIdHex = UserIdHex.ToUpper();