Skip to content

Commit

Permalink
Fix invalid negative literals not throwing error
Browse files Browse the repository at this point in the history
  • Loading branch information
TollyH committed Jun 2, 2024
1 parent 4e59400 commit 5cd2d13
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions Assembler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1423,6 +1423,11 @@ public static byte[] ParseLiteral(string operand, bool allowString, out ulong pa
}
else
{
if (parsedNumber > (ulong)long.MaxValue + 1)
{
throw new OperandException(
string.Format(Strings_Assembler.Error_Literal_Too_Small, long.MinValue, operand));
}
parsedNumber = (ulong)-(long)parsedNumber;
}
}
Expand Down

0 comments on commit 5cd2d13

Please sign in to comment.