Fix FN for size_t, uintmax_t passed as %lx and %llx into printf
This commit is contained in:
parent
f0a7365f35
commit
7cf21f329a
|
@ -1003,8 +1003,14 @@ void CheckIO::checkFormatString(const Token * const tok,
|
|||
if (specifier[1] == 'l') {
|
||||
if (argInfo.typeToken->str() != "long" || !argInfo.typeToken->isLong())
|
||||
invalidPrintfArgTypeError_uint(tok, numFormat, specifier, &argInfo);
|
||||
else if (typesMatch(argInfo.typeToken->originalName(), "size_t") ||
|
||||
argInfo.typeToken->originalName() == "uintmax_t")
|
||||
invalidPrintfArgTypeError_uint(tok, numFormat, specifier, &argInfo);
|
||||
} else if (argInfo.typeToken->str() != "long" || argInfo.typeToken->isLong())
|
||||
invalidPrintfArgTypeError_uint(tok, numFormat, specifier, &argInfo);
|
||||
else if (typesMatch(argInfo.typeToken->originalName(), "size_t") ||
|
||||
argInfo.typeToken->originalName() == "uintmax_t")
|
||||
invalidPrintfArgTypeError_uint(tok, numFormat, specifier, &argInfo);
|
||||
break;
|
||||
case 'j':
|
||||
if (argInfo.typeToken->originalName() != "uintmax_t")
|
||||
|
|
|
@ -3380,15 +3380,15 @@ private:
|
|||
TEST_PRINTF_WARN("%lx","unsigned long","double");
|
||||
TEST_PRINTF_WARN("%lx","unsigned long","long double");
|
||||
TEST_PRINTF_WARN("%lx","unsigned long","void *");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","size_t", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA("%lx","unsigned long","size_t", "unsigned long", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","ssize_t", "signed long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","ptrdiff_t", "signed long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","unsigned ptrdiff_t", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","intmax_t", "signed long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","uintmax_t", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA("%lx","unsigned long","uintmax_t", "unsigned long", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","intptr_t", "signed long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","uintptr_t", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","std::size_t", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA("%lx","unsigned long","std::size_t", "unsigned long", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","std::ssize_t", "signed long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","std::ptrdiff_t", "signed long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN64("%lx","unsigned long","std::intmax_t", "signed long long");
|
||||
|
@ -3444,15 +3444,15 @@ private:
|
|||
TEST_PRINTF_WARN("%llx","unsigned long long","double");
|
||||
TEST_PRINTF_WARN("%llx","unsigned long long","long double");
|
||||
TEST_PRINTF_WARN("%llx","unsigned long long","void *");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","size_t", "unsigned long");
|
||||
TEST_PRINTF_WARN_AKA("%llx","unsigned long long","size_t", "unsigned long", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","ssize_t", "signed long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","ptrdiff_t", "signed long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","unsigned ptrdiff_t", "unsigned long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","intmax_t", "signed long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","uintmax_t", "unsigned long");
|
||||
TEST_PRINTF_WARN_AKA("%llx","unsigned long long","uintmax_t", "unsigned long", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","intptr_t", "signed long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","uintptr_t", "unsigned long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","std::size_t", "unsigned long");
|
||||
TEST_PRINTF_WARN_AKA("%llx","unsigned long long","std::size_t", "unsigned long", "unsigned long long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","std::ssize_t", "signed long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","std::ptrdiff_t", "signed long");
|
||||
TEST_PRINTF_WARN_AKA_WIN32("%llx","unsigned long long","std::intmax_t", "signed long");
|
||||
|
|
Loading…
Reference in New Issue