Skip to content

Commit

Permalink
Fix crash when a REL object incorrectly points outside of memory
Browse files Browse the repository at this point in the history
  • Loading branch information
soopercool101 committed Mar 1, 2024
1 parent e14724e commit 7c2a632
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions BrawlLib/SSBB/ResourceNodes/Modules/RELObjectParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand Down

0 comments on commit 7c2a632

Please sign in to comment.