delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/03/19/16:51:12

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; q=dns; s=default; b=A7f4XuFdzuArIf/3
/MSODL377JUaGJ59Ftrel+WZJCemADPIv+tSNOlB93c2d1Adrsh7GQAJWKtxncgg
urmp75MJ9Z16kxpOiLCom3edWDbBMbDiYurV9izZRgFssxfeDiVQHzYFIR5IFoX8
wiD8KblJvIYFjd4zBKzfizdJgNA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:reply-to:subject:to:references:from:message-id
:date:mime-version:in-reply-to:content-type
:content-transfer-encoding; s=default; bh=HA4xUWIbPYZv1ad4FHOQyZ
lmQ28=; b=vi00RxXtTPmoaNlHGIZEXdP4Mv6F4NfCNIG1wBoy91GIFUQk3mI0Hk
irmCyrGLe1FcHxkTno3JmQBbS+/wovoiuSvfOE7mmRTYMHNIxuE8fmDJKngV9Uqr
R6s46etwUa1gS24rEC7H+HYQtOs80GwxZhwWaXfVjJQJzMuTxPLMc=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=inglis, Inglis, readers, calgary
X-HELO: smtp-out-so.shaw.ca
Reply-To: Brian DOT Inglis AT SystematicSw DOT ab DOT ca
Subject: Re: wcsxfrm() with empty locale crashes the runtime
To: cygwin AT cygwin DOT com
References: <02f956fa-e872-87ba-9ab0-f10afc494a02 AT gmail DOT com>
From: Brian Inglis <Brian DOT Inglis AT SystematicSw DOT ab DOT ca>
Openpgp: preference=signencrypt
Message-ID: <6984cbb0-00c2-8da9-63a8-ef59daf65703@SystematicSw.ab.ca>
Date: Tue, 19 Mar 2019 14:50:57 -0600
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.5.3
MIME-Version: 1.0
In-Reply-To: <02f956fa-e872-87ba-9ab0-f10afc494a02@gmail.com>
X-IsSubscribed: yes

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019