mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2024-11-15 01:25:25 +00:00
Fix invalid audio renderer buffer size when end offset < start offset (#5588)
* Fix invalid audio renderer buffer size when end offset < start offset * Fix possible overflow on IsSampleOffsetInRangeForPcm
This commit is contained in:
parent
3e5c211394
commit
7f96dbc024
|
@ -20,6 +20,11 @@ namespace Ryujinx.Audio.Renderer.Dsp
|
|||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static int GetBufferSize<T>(int startSampleOffset, int endSampleOffset, int offset, int count) where T : unmanaged
|
||||
{
|
||||
if (endSampleOffset < startSampleOffset)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GetCountToDecode(startSampleOffset, endSampleOffset, offset, count) * Unsafe.SizeOf<T>();
|
||||
}
|
||||
|
||||
|
|
|
@ -264,8 +264,8 @@ namespace Ryujinx.Audio.Renderer.Parameter
|
|||
{
|
||||
uint dataTypeSize = (uint)Unsafe.SizeOf<T>();
|
||||
|
||||
return StartSampleOffset * dataTypeSize <= Size &&
|
||||
EndSampleOffset * dataTypeSize <= Size;
|
||||
return (ulong)StartSampleOffset * dataTypeSize <= Size &&
|
||||
(ulong)EndSampleOffset * dataTypeSize <= Size;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
|
Loading…
Reference in a new issue