Re: Server 2016 - msvcrt.dll - %z formatting crash

Eli Zaretskii <eliz-mXXj517/[email protected]> Thu, 10 Dec 2020 18:44:41 +0200
Newsgroups gmane.comp.gnu.mingw.user
Message-ID <[email protected]>
> From: Clint Dovholuk <[email protected]>
> 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.

_______________________________________________
MinGW-Users mailing list
[email protected]

This list observes the Posting Etiquette, as described at https://mingw.osdn.io/index.html?page=mailing.html#list-etiquette.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.osdn.me/mailman/listinfo/mingw-users
Also: mailto:[email protected]?subject=unsubscribe