wcsxfrm() with empty locale crashes the runtime

Brian Inglis Brian.Inglis@SystematicSw.ab.ca
Tue Mar 19 20:51:00 GMT 2019


On 2019-03-19 13:28, LRN wrote:
> 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.

$ man wcsxfrm
...
	If n is 0, stra may be a NULL pointer.

	(NOT Cygwin:) The current implementation of wcsxfrm simply uses wcslcpy
	and does not support any language-specific transformations.
...

As wcslcpy is a BSD extension, any expectations are excessive; OpenBSD says:

"Also note that wcslcpy() and wcslcat() only operate on wide strings that are
terminated with a null wide character (L'\0'). This means that for wcslcpy() src
must be terminated with a null wide character..."

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

This email may be disturbing to some readers as it contains
too much technical detail. Reader discretion is advised.

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list