From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 71575 invoked by alias); 19 Mar 2019 20:51:03 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 71567 invoked by uid 89); 19 Mar 2019 20:51:03 -0000 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 Received: from smtp-out-so.shaw.ca (HELO smtp-out-so.shaw.ca) (64.59.136.139) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 19 Mar 2019 20:51:01 +0000 Received: from [192.168.1.114] ([24.64.172.44]) by shaw.ca with ESMTP id 6LhJh7w8CGusj6LhLhdk6V; Tue, 19 Mar 2019 14:50:59 -0600 Reply-To: Brian.Inglis@SystematicSw.ab.ca Subject: Re: wcsxfrm() with empty locale crashes the runtime To: cygwin@cygwin.com References: <02f956fa-e872-87ba-9ab0-f10afc494a02@gmail.com> From: Brian Inglis Openpgp: preference=signencrypt Message-ID: <6984cbb0-00c2-8da9-63a8-ef59daf65703@SystematicSw.ab.ca> Date: Tue, 19 Mar 2019 20:51:00 -0000 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> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-IsSubscribed: yes X-SW-Source: 2019-03/txt/msg00494.txt.bz2 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