mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2024-12-23 16:31:21 -08:00
amadeus: Fix wrong Span usage in CopyHistories (#3181)
Fix a copypasta from the original Amadeus PR causing invalid CopyHistories output. Also added a missing size check. This fix a crash in Mononoke Slashdown
This commit is contained in:
parent
7af9fcbc06
commit
54bfaa125d
@ -149,11 +149,21 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
|
|||||||
|
|
||||||
Span<byte> targetSpan = performanceOutput.Slice(nextOffset);
|
Span<byte> targetSpan = performanceOutput.Slice(nextOffset);
|
||||||
|
|
||||||
|
// NOTE: We check for the space for two headers for the final blank header.
|
||||||
|
int requiredSpace = Unsafe.SizeOf<THeader>() + Unsafe.SizeOf<TEntry>() * inputHeader.GetEntryCount()
|
||||||
|
+ Unsafe.SizeOf<TEntryDetail>() * inputHeader.GetEntryDetailCount()
|
||||||
|
+ Unsafe.SizeOf<THeader>();
|
||||||
|
|
||||||
|
if (targetSpan.Length < requiredSpace)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
ref THeader outputHeader = ref MemoryMarshal.Cast<byte, THeader>(targetSpan)[0];
|
ref THeader outputHeader = ref MemoryMarshal.Cast<byte, THeader>(targetSpan)[0];
|
||||||
|
|
||||||
nextOffset += Unsafe.SizeOf<THeader>();
|
nextOffset += Unsafe.SizeOf<THeader>();
|
||||||
|
|
||||||
Span<TEntry> outputEntries = MemoryMarshal.Cast<byte, TEntry>(targetSpan.Slice(nextOffset));
|
Span<TEntry> outputEntries = MemoryMarshal.Cast<byte, TEntry>(performanceOutput.Slice(nextOffset));
|
||||||
|
|
||||||
int totalProcessingTime = 0;
|
int totalProcessingTime = 0;
|
||||||
|
|
||||||
@ -175,7 +185,7 @@ namespace Ryujinx.Audio.Renderer.Server.Performance
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Span<TEntryDetail> outputEntriesDetail = MemoryMarshal.Cast<byte, TEntryDetail>(targetSpan.Slice(nextOffset));
|
Span<TEntryDetail> outputEntriesDetail = MemoryMarshal.Cast<byte, TEntryDetail>(performanceOutput.Slice(nextOffset));
|
||||||
|
|
||||||
int effectiveEntryDetailCount = 0;
|
int effectiveEntryDetailCount = 0;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user