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:
parent
8bf102d2cd
commit
ccbbaddbcb
3 changed files with 5 additions and 1 deletions
|
@ -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,
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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++];
|
||||||
|
|
Loading…
Reference in a new issue