diff options
| author | Thomas Guillemard <thog@protonmail.com> | 2018-12-22 18:42:48 +0100 |
|---|---|---|
| committer | gdkchan <gab.dark.100@gmail.com> | 2018-12-22 15:42:48 -0200 |
| commit | d8f2497f155046402cd15c65eca0326faf3aefd6 (patch) | |
| tree | 8f323890190a30f40d5ab87ac05d3054730698c6 | |
| parent | 0039bb639493b2d1e2764cae380311ba8e87704b (diff) | |
Fix issues with compressed NSO without a section (#548)
* Fix issues with compressed NSO without a section
Avoid trying to decompress something that doesn't exist
* don't use the lengths of the buffer directly
| -rw-r--r-- | Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs b/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs index c0b2e947..c35a8f1a 100644 --- a/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs +++ b/Ryujinx.HLE/Loaders/Executables/NxStaticObject.cs @@ -80,7 +80,7 @@ namespace Ryujinx.HLE.Loaders.Executables Text = reader.ReadBytes(textSize); - if (flags.HasFlag(NsoFlags.IsTextCompressed)) + if (flags.HasFlag(NsoFlags.IsTextCompressed) && textSize != 0) { Text = Lz4.Decompress(Text, textDecSize); } @@ -90,7 +90,7 @@ namespace Ryujinx.HLE.Loaders.Executables Ro = reader.ReadBytes(roSize); - if (flags.HasFlag(NsoFlags.IsRoCompressed)) + if (flags.HasFlag(NsoFlags.IsRoCompressed) && roSize != 0) { Ro = Lz4.Decompress(Ro, roDecSize); } @@ -100,7 +100,7 @@ namespace Ryujinx.HLE.Loaders.Executables Data = reader.ReadBytes(dataSize); - if (flags.HasFlag(NsoFlags.IsDataCompressed)) + if (flags.HasFlag(NsoFlags.IsDataCompressed) && dataSize != 0) { Data = Lz4.Decompress(Data, dataDecSize); } |
