From 5cd2d13075e7c4343ada6ac77d1b051f698f42bc Mon Sep 17 00:00:00 2001 From: TollyH Date: Sun, 2 Jun 2024 13:52:28 +0100 Subject: [PATCH] Fix invalid negative literals not throwing error --- Assembler.cs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Assembler.cs b/Assembler.cs index 893a86e..1a29a31 100644 --- a/Assembler.cs +++ b/Assembler.cs @@ -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; } }