diff options
-rw-r--r-- | lib/common/ConversionString.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/lib/common/ConversionString.cpp b/lib/common/ConversionString.cpp index 9e237a77..b86bad4f 100644 --- a/lib/common/ConversionString.cpp +++ b/lib/common/ConversionString.cpp @@ -72,11 +72,17 @@ int32_t BoxConvert::_ConvertStringToInt(const char *pString, int Size) { case 32: { - // No extra checking needed, if this assert holds true - ASSERT(sizeof(long) == sizeof(int32_t)); + // No extra checking needed if long is an int32 + if(sizeof(long) > sizeof(int32_t)) + { + if(r <= (0 - 0x7fffffffL) || r > 0x7fffffffL) + { + THROW_EXCEPTION(ConversionException, IntOverflowInConvertFromString) + } + } + break; } - break; - + case 16: { if(r <= (0 - 0x7fff) || r > 0x7fff) |