From eb4bb893b3615656cf1db7ac69f92a43a6c2873c Mon Sep 17 00:00:00 2001 From: Dmitry-Me Date: Mon, 20 Nov 2017 22:31:13 +0300 Subject: [PATCH] Fix FP for std::intmax_t passed as %jd into scanf --- lib/checkio.cpp | 2 +- test/testio.cpp | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/checkio.cpp b/lib/checkio.cpp index c60008c9d..21aaa87fa 100644 --- a/lib/checkio.cpp +++ b/lib/checkio.cpp @@ -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': diff --git a/test/testio.cpp b/test/testio.cpp index e446bb943..9af1de280 100644 --- a/test/testio.cpp +++ b/test/testio.cpp @@ -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");