Fix FN for std::intmax_t passed as %ld, %lld into scanf
This commit is contained in:
parent
7cf21f329a
commit
5869f6d989
|
@ -827,12 +827,12 @@ void CheckIO::checkFormatString(const Token * const tok,
|
||||||
if (argInfo.typeToken->str() != "long" || !argInfo.typeToken->isLong())
|
if (argInfo.typeToken->str() != "long" || !argInfo.typeToken->isLong())
|
||||||
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
||||||
else if (typesMatch(argInfo.typeToken->originalName(), "ptrdiff_t") ||
|
else if (typesMatch(argInfo.typeToken->originalName(), "ptrdiff_t") ||
|
||||||
argInfo.typeToken->originalName() == "intmax_t")
|
typesMatch(argInfo.typeToken->originalName(), "intmax_t"))
|
||||||
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
||||||
} else if (argInfo.typeToken->str() != "long" || argInfo.typeToken->isLong())
|
} else if (argInfo.typeToken->str() != "long" || argInfo.typeToken->isLong())
|
||||||
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
||||||
else if (typesMatch(argInfo.typeToken->originalName(), "ptrdiff_t") ||
|
else if (typesMatch(argInfo.typeToken->originalName(), "ptrdiff_t") ||
|
||||||
argInfo.typeToken->originalName() == "intmax_t")
|
typesMatch(argInfo.typeToken->originalName(), "intmax_t"))
|
||||||
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, false);
|
||||||
break;
|
break;
|
||||||
case 'I':
|
case 'I':
|
||||||
|
|
|
@ -1076,6 +1076,7 @@ private:
|
||||||
TEST_SCANF_WARN_AKA("%ld","long","size_t","unsigned long","unsigned long long");
|
TEST_SCANF_WARN_AKA("%ld","long","size_t","unsigned long","unsigned long long");
|
||||||
TEST_SCANF_WARN_AKA("%ld","long","intmax_t", "signed long", "signed long long");
|
TEST_SCANF_WARN_AKA("%ld","long","intmax_t", "signed long", "signed long long");
|
||||||
TEST_SCANF_WARN_AKA("%ld","long","std::ptrdiff_t", "signed long", "signed long long");
|
TEST_SCANF_WARN_AKA("%ld","long","std::ptrdiff_t", "signed long", "signed long long");
|
||||||
|
TEST_SCANF_WARN_AKA("%ld","long","std::intmax_t", "signed long", "signed long long");
|
||||||
TEST_SCANF_WARN_AKA_WIN64("%ld","long","std::intptr_t", "signed long long");
|
TEST_SCANF_WARN_AKA_WIN64("%ld","long","std::intptr_t", "signed long long");
|
||||||
TEST_SCANF_WARN_AKA("%ld","long","std::uintptr_t", "unsigned long", "unsigned long long");
|
TEST_SCANF_WARN_AKA("%ld","long","std::uintptr_t", "unsigned long", "unsigned long long");
|
||||||
|
|
||||||
|
@ -1151,6 +1152,7 @@ private:
|
||||||
TEST_SCANF_WARN_AKA("%lld","long long","size_t", "unsigned long", "unsigned long long");
|
TEST_SCANF_WARN_AKA("%lld","long long","size_t", "unsigned long", "unsigned long long");
|
||||||
TEST_SCANF_WARN_AKA("%lld","long long","intmax_t", "signed long", "signed long long");
|
TEST_SCANF_WARN_AKA("%lld","long long","intmax_t", "signed long", "signed long long");
|
||||||
TEST_SCANF_WARN_AKA("%lld","long long","std::ptrdiff_t", "signed long", "signed long long");
|
TEST_SCANF_WARN_AKA("%lld","long long","std::ptrdiff_t", "signed long", "signed long long");
|
||||||
|
TEST_SCANF_WARN_AKA("%lld","long long","std::intmax_t", "signed long", "signed long long");
|
||||||
TEST_SCANF_WARN_AKA_WIN32("%lld","long long","std::intptr_t", "signed long");
|
TEST_SCANF_WARN_AKA_WIN32("%lld","long long","std::intptr_t", "signed long");
|
||||||
|
|
||||||
TEST_SCANF_WARN("%hu", "unsigned short", "bool");
|
TEST_SCANF_WARN("%hu", "unsigned short", "bool");
|
||||||
|
|
Loading…
Reference in New Issue