Web lists-archives.com

wcsxfrm() with empty locale crashes the runtime




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.
#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;
}

Attachment: signature.asc
Description: OpenPGP digital signature