From cf07af6eaef5b6e9c1b53196dadd71843e461425 Mon Sep 17 00:00:00 2001 From: Sajid Anwar Date: Fri, 15 Jun 2018 12:29:24 -0700 Subject: [PATCH] Fix bounds check on reading the IPC buffer --- Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs b/Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs index 7ed8d9b8b0..9cf1f69660 100644 --- a/Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs +++ b/Ryujinx.HLE/OsHle/Ipc/IpcMessage.cs @@ -176,14 +176,14 @@ namespace Ryujinx.HLE.OsHle.Ipc public (long Position, long Size) GetBufferType0x21(int Index = 0) { - if (PtrBuff.Count != 0 && + if (PtrBuff.Count > Index && PtrBuff[Index].Position != 0 && PtrBuff[Index].Size != 0) { return (PtrBuff[Index].Position, PtrBuff[Index].Size); } - if (SendBuff.Count != 0 && + if (SendBuff.Count > Index && SendBuff[Index].Position != 0 && SendBuff[Index].Size != 0) { @@ -195,14 +195,14 @@ namespace Ryujinx.HLE.OsHle.Ipc public (long Position, long Size) GetBufferType0x22(int Index = 0) { - if (RecvListBuff.Count != 0 && + if (RecvListBuff.Count > Index && RecvListBuff[Index].Position != 0 && RecvListBuff[Index].Size != 0) { return (RecvListBuff[Index].Position, RecvListBuff[Index].Size); } - if (ReceiveBuff.Count != 0 && + if (ReceiveBuff.Count > Index && ReceiveBuff[Index].Position != 0 && ReceiveBuff[Index].Size != 0) {