[MinGW-Users] Server 2016 - msvcrt.dll - %z formatting crash

Back to archive index
Eli Zaretskii eliz****@gnu*****
Fri Dec 11 01:44:41 JST 2020


> From: Clint Dovholuk <clint****@netfo*****>
> Date: Thu, 10 Dec 2020 11:22:31 -0500
> 
> I tried hard to search for this answer so forgive me if I did not find the proper thread. Basically this simple
> program will crash on windows server
> 
> 2016
> 
>  
> 
>     int main() {
> 
>         size_t val = -42;
> 
>         printf("this will crash %zd(%s)\n", val, "this is some string");
> 
>         return 0;
> 
>     }
> 
>  
> 
> Msvcrt.dll and this program run fine on Windows 10 so it appears MS has patched this particular issue in
> recent versions of Windows.

I suggest to use -D__MINGW_ANSI_STDIO__ when you build your program,
so that your program gets linked with the ANSI-standard replacements
for printf and friends, which support %zd.  Then the crash shouldn't
happen.



More information about the MinGW-Users mailing list
Back to archive index