From 7c2a632ea09f77e9585aeb4eee358317a226539c Mon Sep 17 00:00:00 2001 From: soopercool101 Date: Thu, 29 Feb 2024 19:53:32 -0700 Subject: [PATCH] Fix crash when a REL object incorrectly points outside of memory --- BrawlLib/SSBB/ResourceNodes/Modules/RELObjectParser.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BrawlLib/SSBB/ResourceNodes/Modules/RELObjectParser.cs b/BrawlLib/SSBB/ResourceNodes/Modules/RELObjectParser.cs index d4a2b3b1a..694f7acf8 100644 --- a/BrawlLib/SSBB/ResourceNodes/Modules/RELObjectParser.cs +++ b/BrawlLib/SSBB/ResourceNodes/Modules/RELObjectParser.cs @@ -53,12 +53,12 @@ private unsafe RELType ParseDeclaration(int index) } uint relOffset = cmd.Apply(Manager.GetUint(index), 0); - if (relOffset > _objectSection._dataOffset + _objectSection._dataSize) + if (relOffset > _objectSection._dataOffset + _objectSection._dataSize || relOffset > _objectSection.WorkingUncompressed.Length) { return null; } - string name = new string((sbyte*) (_objectSection.Header + relOffset)); + string name = (_objectSection.Header + relOffset).GetUTF8String(); if (string.IsNullOrWhiteSpace(name)) {