0
0
Fork 0
mirror of https://github.com/ryujinx-mirror/ryujinx.git synced 2024-12-23 00:25:46 +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> dataWords = Span<uint>.Empty;
Span<uint> dataWordsPadded = Span<uint>.Empty;
if (meta.DataWordsCount != 0) if (meta.DataWordsCount != 0)
{ {
@ -189,6 +190,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
int padding = (dataOffsetAligned - dataOffset) / sizeof(uint); int padding = (dataOffsetAligned - dataOffset) / sizeof(uint);
dataWords = MemoryMarshal.Cast<byte, uint>(data)[padding..meta.DataWordsCount]; dataWords = MemoryMarshal.Cast<byte, uint>(data)[padding..meta.DataWordsCount];
dataWordsPadded = MemoryMarshal.Cast<byte, uint>(data)[..meta.DataWordsCount];
data = data[(meta.DataWordsCount * sizeof(uint))..]; data = data[(meta.DataWordsCount * sizeof(uint))..];
} }
@ -209,6 +211,7 @@ namespace Ryujinx.Horizon.Sdk.Sf.Hipc
ReceiveBuffers = receiveBuffers, ReceiveBuffers = receiveBuffers,
ExchangeBuffers = exchangeBuffers, ExchangeBuffers = exchangeBuffers,
DataWords = dataWords, DataWords = dataWords,
DataWordsPadded = dataWordsPadded,
ReceiveList = receiveList, ReceiveList = receiveList,
CopyHandles = copyHandles, CopyHandles = copyHandles,
MoveHandles = moveHandles, MoveHandles = moveHandles,

View file

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

View file

@ -206,7 +206,7 @@ namespace Ryujinx.Horizon.Sdk.Sf
} }
else 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..]); var recvPointerSizes = MemoryMarshal.Cast<byte, ushort>(data[runtimeMetadata.UnfixedOutPointerSizeOffset..]);
size = recvPointerSizes[unfixedRecvPointerIndex++]; size = recvPointerSizes[unfixedRecvPointerIndex++];