Fix FN for unsigned ptrdiff_t passed as %lu into scanf

This commit is contained in:
Dmitry-Me 2017-11-09 14:43:09 +03:00
parent 054444167d
commit b301b44897
2 changed files with 2 additions and 1 deletions

View File

@ -904,6 +904,7 @@ void CheckIO::checkFormatString(const Token * const tok,
} else if (argInfo.typeToken->str() != "long" || argInfo.typeToken->isLong()) } else if (argInfo.typeToken->str() != "long" || argInfo.typeToken->isLong())
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, true); invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, true);
else if (typesMatch(argInfo.typeToken->originalName(), "size_t") || else if (typesMatch(argInfo.typeToken->originalName(), "size_t") ||
typesMatch(argInfo.typeToken->originalName(), "ptrdiff_t") ||
argInfo.typeToken->originalName() == "uintmax_t") argInfo.typeToken->originalName() == "uintmax_t")
invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, true); invalidScanfArgTypeError_int(tok, numFormat, specifier, &argInfo, true);
break; break;

View File

@ -1001,7 +1001,7 @@ private:
TEST_SCANF_WARN_AKA("%lu","unsigned long","size_t","unsigned long","unsigned long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","size_t","unsigned long","unsigned long long");
TEST_SCANF_WARN_AKA("%lu","unsigned long","ssize_t", "signed long", "signed long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","ssize_t", "signed long", "signed long long");
TEST_SCANF_WARN_AKA("%lu","unsigned long","ptrdiff_t", "signed long", "signed long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","ptrdiff_t", "signed long", "signed long long");
TEST_SCANF_WARN_AKA_WIN64("%lu","unsigned long","unsigned ptrdiff_t", "unsigned long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","unsigned ptrdiff_t", "unsigned long", "unsigned long long");
TEST_SCANF_WARN_AKA("%lu","unsigned long","intmax_t", "signed long", "signed long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","intmax_t", "signed long", "signed long long");
TEST_SCANF_WARN_AKA("%lu","unsigned long","uintmax_t","unsigned long", "unsigned long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","uintmax_t","unsigned long", "unsigned long long");
TEST_SCANF_WARN_AKA("%lu","unsigned long","intptr_t", "signed long", "signed long long"); TEST_SCANF_WARN_AKA("%lu","unsigned long","intptr_t", "signed long", "signed long long");