Fix FP for std::intmax_t passed as %jd into scanf

This commit is contained in:
Dmitry-Me 2017-11-20 22:31:13 +03:00
parent 125daec71b
commit eb4bb893b3
2 changed files with 2 additions and 1 deletions

View File

@ -846,7 +846,7 @@ void CheckIO::checkFormatString(const Token * const tok,
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
break;
case 'j':
if (argInfo.typeToken->originalName() != "intmax_t")
if (!typesMatch(argInfo.typeToken->originalName(), "intmax_t"))
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
break;
case 'z':

View File

@ -1456,6 +1456,7 @@ private:
TEST_SCANF_WARN_AKA("%jd", "intmax_t", "std::ptrdiff_t", "signed long", "signed long long");
TEST_SCANF_NOWARN("%jd", "intmax_t", "intmax_t");
TEST_SCANF_WARN_AKA("%jd", "intmax_t", "uintmax_t", "unsigned long", "unsigned long long");
TEST_SCANF_NOWARN("%jd", "intmax_t", "std::intmax_t");
TEST_SCANF_WARN("%zu", "size_t", "bool");
TEST_SCANF_WARN("%zu", "size_t", "char");