mirror of
https://github.com/ryujinx-mirror/ryujinx.git
synced 2024-11-25 19:45:13 +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
2 changed files with 7 additions and 2 deletions
|
@ -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