Skip to content
Permalink
Browse files

- reverted the clamping when assigning to FScanner::Number.

This broke unsigned integer parsing without explicitly declaring the constant unsigned.
  • Loading branch information
coelckers committed Jan 4, 2020
1 parent 847cbcc commit 26784d7453ab7f7bada5a30fe4afe205ad65c43d
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/utility/sc_man.cpp
@@ -600,13 +600,13 @@ bool FScanner::GetToken ()
{
TokenType = TK_UIntConst;
BigNumber = (int64_t)strtoull(String, &stopper, 0);
Number = (int)clamp<int64_t>(BigNumber, 0, UINT_MAX);
Number = (int)BigNumber;// clamp<int64_t>(BigNumber, 0, UINT_MAX);
Float = (unsigned)Number;
}
else
{
BigNumber = strtoll(String, &stopper, 0);
Number = (int)clamp<int64_t>(BigNumber, INT_MIN, INT_MAX);
Number = (int)BigNumber;// clamp<int64_t>(BigNumber, 0, UINT_MAX);
Float = Number;
}
}
@@ -708,7 +708,7 @@ bool FScanner::GetNumber ()
else
{
BigNumber = strtoll(String, &stopper, 0);
Number = (int)clamp<int64_t>(BigNumber, INT_MIN, INT_MAX);
Number = (int)BigNumber;// clamp<int64_t>(BigNumber, 0, UINT_MAX);
if (*stopper != 0)
{
ScriptError ("SC_GetNumber: Bad numeric constant \"%s\".", String);
@@ -765,7 +765,7 @@ bool FScanner::CheckNumber ()
else
{
BigNumber = strtoll (String, &stopper, 0);
Number = (int)clamp<int64_t>(BigNumber, INT_MIN, INT_MAX);
Number = (int)BigNumber;// clamp<int64_t>(BigNumber, 0, UINT_MAX);
if (*stopper != 0)
{
UnGet();

0 comments on commit 26784d7

Please sign in to comment.
You can’t perform that action at this time.