diff --git a/lib/mathlib.cpp b/lib/mathlib.cpp index eb6098a66..0d8c75c2e 100644 --- a/lib/mathlib.cpp +++ b/lib/mathlib.cpp @@ -813,9 +813,10 @@ bool MathLib::isIntHex(const std::string& str) state = DIGIT; else return false; + break; case DIGIT: if (isxdigit(static_cast(*it))) - ; // state = DIGITS; + ; // state = DIGIT; else return isValidIntegerSuffix(it,str.end()); break; diff --git a/test/testmathlib.cpp b/test/testmathlib.cpp index fac472bf3..8d32fbba1 100644 --- a/test/testmathlib.cpp +++ b/test/testmathlib.cpp @@ -668,6 +668,7 @@ private: ASSERT_EQUALS(false, MathLib::isIntHex("+0x")); ASSERT_EQUALS(false, MathLib::isIntHex("-0x")); ASSERT_EQUALS(false, MathLib::isIntHex("0x")); + ASSERT_EQUALS(false, MathLib::isIntHex("0xl")); ASSERT_EQUALS(false, MathLib::isIntHex("0xx")); ASSERT_EQUALS(false, MathLib::isIntHex("-0175")); ASSERT_EQUALS(false, MathLib::isIntHex("-0_garbage_"));