From b2ebbe8b22f241a624ecba2e6084d255827dc25c Mon Sep 17 00:00:00 2001
From: Mary <me@thog.eu>
Date: Sun, 23 Jan 2022 23:36:31 +0100
Subject: [PATCH] amadeus: Fix possible device sink input out of bound (#3032)

This fix an out of bound when indexing inputs for games that uses
unsupported values (8 here)

Close #2724.
---
 Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs b/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
index 28b4a5f175..ca81e7916b 100644
--- a/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
+++ b/Ryujinx.Audio/Renderer/Dsp/Command/DeviceSinkCommand.cs
@@ -52,7 +52,7 @@ namespace Ryujinx.Audio.Renderer.Dsp.Command
             InputCount = sink.Parameter.InputCount;
             InputBufferIndices = new ushort[InputCount];
 
-            for (int i = 0; i < InputCount; i++)
+            for (int i = 0; i < Math.Min(InputCount, Constants.ChannelCountMax); i++)
             {
                 InputBufferIndices[i] = (ushort)(bufferOffset + sink.Parameter.Input[i]);
             }