0
0
Fork 0
mirror of https://github.com/GreemDev/Ryujinx.git synced 2024-12-23 02:15:49 +00:00

Fix exception when trying to read output pointer buffer size (#6221)

* Fix exception when trying to read output pointer buffer size

* Better name
This commit is contained in:
gdkchan 2024-01-29 21:19:39 -03:00 committed by GitHub
parent 8bf102d2cd
commit ccbbaddbcb
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 5 additions and 1 deletions

View file

@ -181,6 +181,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
}
Span<uint> dataWords = Span<uint>.Empty;
Span<uint> dataWordsPadded = Span<uint>.Empty;
if (meta.DataWordsCount != 0)
{
@ -189,6 +190,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
int padding = (dataOffsetAligned - dataOffset) / sizeof(uint);
dataWords = MemoryMarshal.Cast<byte, uint>(data)[padding..meta.DataWordsCount];
dataWordsPadded = MemoryMarshal.Cast<byte, uint>(data)[..meta.DataWordsCount];
data = data[(meta.DataWordsCount * sizeof(uint))..];
}
@ -209,6 +211,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
ReceiveBuffers = receiveBuffers,
ExchangeBuffers = exchangeBuffers,
DataWords = dataWords,
DataWordsPadded = dataWordsPadded,
ReceiveList = receiveList,
CopyHandles = copyHandles,
MoveHandles = moveHandles,

View file

@ -9,6 +9,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
public Span<HipcBufferDescriptor> ReceiveBuffers;
public Span<HipcBufferDescriptor> ExchangeBuffers;
public Span<uint> DataWords;
public Span<uint> DataWordsPadded;
public Span<HipcReceiveListEntry> ReceiveList;
public Span<int> CopyHandles;
public Span<int> MoveHandles;

View file

@ -206,7 +206,7 @@ namespace Ryujinx.Horizon.Sdk.Sf
}
else
{
var data = MemoryMarshal.Cast<uint, byte>(context.Request.Data.DataWords);
var data = MemoryMarshal.Cast<uint, byte>(context.Request.Data.DataWordsPadded);
var recvPointerSizes = MemoryMarshal.Cast<byte, ushort>(data[runtimeMetadata.UnfixedOutPointerSizeOffset..]);
size = recvPointerSizes[unfixedRecvPointerIndex++];