diff options
| author | gdk <gab.dark.100@gmail.com> | 2019-11-14 15:29:32 -0300 |
|---|---|---|
| committer | Thog <thog@protonmail.com> | 2020-01-09 02:13:00 +0100 |
| commit | eea73bc421d359f0df60f377d2f921357a217416 (patch) | |
| tree | 416f2ea55b915be1cffafd18e0621d8f23839f93 /Ryujinx.Graphics.Shader/Decoders/Decoder.cs | |
| parent | 6e399061ceefb532561c4c5a5cd2681228e1231e (diff) | |
Add missing check for BRX, do not add a out of bounds block to the queue
Diffstat (limited to 'Ryujinx.Graphics.Shader/Decoders/Decoder.cs')
| -rw-r--r-- | Ryujinx.Graphics.Shader/Decoders/Decoder.cs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs index 6841c98d..9f039b94 100644 --- a/Ryujinx.Graphics.Shader/Decoders/Decoder.cs +++ b/Ryujinx.Graphics.Shader/Decoders/Decoder.cs @@ -45,6 +45,8 @@ namespace Ryujinx.Graphics.Shader.Decoders GetBlock(0); + ulong maxAddress = (ulong)code.Length - headerSize; + while (workQueue.TryDequeue(out Block currBlock)) { // Check if the current block is inside another block. @@ -65,7 +67,7 @@ namespace Ryujinx.Graphics.Shader.Decoders } // If we have a block after the current one, set the limit address. - ulong limitAddress = (ulong)code.Length - headerSize; + ulong limitAddress = maxAddress; if (nBlkIndex != blocks.Count) { @@ -140,7 +142,7 @@ namespace Ryujinx.Graphics.Shader.Decoders } // Do we have a block after the current one? - if (!IsExit(currBlock.GetLastOp()) && currBlock.BrIndir != null) + if (!IsExit(currBlock.GetLastOp()) && currBlock.BrIndir != null && currBlock.EndAddress < maxAddress) { bool targetVisited = visited.ContainsKey(currBlock.EndAddress); |
