Skip to content

Commit

Permalink
Bugfix in RespReadUtils (#803)
Browse files Browse the repository at this point in the history
* Fixing overflow bug in RespReadUtils

* Comment fix

* Fixed comment
  • Loading branch information
TalZaccai authored Nov 15, 2024
1 parent f6cda53 commit 2774e6a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion libs/common/RespReadUtils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ public static bool ReadSignedLengthHeader(out int length, ref byte* ptr, byte* e
}

// Validate length
if (value > int.MaxValue)
if (value > int.MaxValue && (!negative || value > int.MaxValue + (ulong)1)) // int.MinValue = -(int.MaxValue + 1)
{
RespParsingException.ThrowIntegerOverflow(readHead - digitsRead, (int)digitsRead);
}
Expand Down

0 comments on commit 2774e6a

Please sign in to comment.