Skip to content

Wrong MSVC version guard for C99 format size specifiers #10017

@bensze01

Description

@bensze01

Summary

In include/mbedtls/debug.h we have the following #ifdef guard for using C99 format size specifiers:

#if (defined(__MINGW32__) && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800)
   #include <inttypes.h>
   #define MBEDTLS_PRINTF_SIZET     PRIuPTR
   #define MBEDTLS_PRINTF_LONGLONG  "I64d"
#else \
    /* (defined(__MINGW32__)  && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) */
   #define MBEDTLS_PRINTF_SIZET     "zu"
   #define MBEDTLS_PRINTF_LONGLONG  "lld"
#endif \
    /* (defined(__MINGW32__)  && __USE_MINGW_ANSI_STDIO == 0) || (defined(_MSC_VER) && _MSC_VER < 1800) */

However, _MSC_VER = 1800 corresponds to Visual Studio 2013, which doesn't support several C99 size specifiers, including zu, causing runtime failures.

Metadata

Metadata

Assignees

Labels

bugcomponent-platformPortability layer and build scriptssize-xsEstimated task size: extra small (a few hours at most)

Type

No type

Projects

Status

Done

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions