wcsxfrm() with empty locale crashes the runtime

LRN lrn1986@gmail.com
Tue Mar 19 19:28:00 GMT 2019


The testcase is attached. Running it with Cygwin-i386 leads to a crash. My
guess is that the implementation is not POSIX-conformant and tries to
dereference the first argument (NULL), even though the third argument is 0.

Tested with Cygwin-3.0.4.
-------------- next part --------------
#include <wchar.h>
#include <stdlib.h>
#include <locale.h>

int
main ()
{
  wchar_t w[2] = { L'z', L'\0' };
  setlocale (LC_ALL, "");
  int l = wcsxfrm (NULL, w, 0);
  return l;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190319/26bec79d/attachment.sig>


More information about the Cygwin mailing list