Merge pull request #8845

cfc6227 cryptonote_basic: fix amount overflow detection on 32-bit systems [RELEASE] (jeffro256)
This commit is contained in:
luigi1111 2023-06-27 11:38:42 -05:00
commit 54f0f9eb96
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -1229,7 +1229,7 @@ namespace cryptonote
char *end = NULL; char *end = NULL;
errno = 0; errno = 0;
const unsigned long long ull = strtoull(buf, &end, 10); const unsigned long long ull = strtoull(buf, &end, 10);
CHECK_AND_ASSERT_THROW_MES(ull != ULONG_MAX || errno == 0, "Failed to parse rounded amount: " << buf); CHECK_AND_ASSERT_THROW_MES(ull != ULLONG_MAX || errno == 0, "Failed to parse rounded amount: " << buf);
CHECK_AND_ASSERT_THROW_MES(ull != 0 || amount == 0, "Overflow in rounding"); CHECK_AND_ASSERT_THROW_MES(ull != 0 || amount == 0, "Overflow in rounding");
return ull; return ull;
} }