| delorie.com/archives/browse.cgi | search |
| 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:date:from:to:cc:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; q=dns; s= | |
| default; b=LzbD2tIhX/3iu5ubP2io2CNYIOqxJdousZB80CzUjUXLOHhmgpdc8 | |
| Kd4M38twCx223Rd26hcdw88QLhl6+rlVbC0cbK70S0TUjANb5/UaEEY2jXWvTB0m | |
| N8E2wcv5EH/sXGsZvOpUIvYal+3KpvTbBPsk0M2efvScBVsKKiftes= | |
| 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:date:from:to:cc:subject:message-id:reply-to | |
| :references:mime-version:content-type:in-reply-to; s=default; | |
| bh=YW7aDJ+B4MDSFpAB2FkWBklwv7w=; b=NSgv44wAySwMxJFoUqC58Jk5LN97 | |
| R3IehBKSVxL8k6wntBIHzP2pKFepb2ERBeuCkzx0ROsFE2wbqvq0rNEBRoAvlUA2 | |
| SCCCPo5D4x8bRQF+F1r5AFjAhbYQc46tmSnB7rs2FbSkgC3VKm4SnoT9hIp4W7dN | |
| nOhRCyfLTD2WTew= | |
| 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=-101.8 required=5.0 tests=AWL,BAYES_00,GOOD_FROM_CORINNA_CYGWIN,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 spammy=lz, Lz, desktop, uploaded |
| X-HELO: | mout.kundenserver.de |
| Date: | Tue, 19 Mar 2019 21:42:47 +0100 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| To: | LRN <lrn1986 AT gmail DOT com> |
| Cc: | cygwin AT cygwin DOT com |
| Subject: | Re: wcsxfrm() with empty locale crashes the runtime |
| Message-ID: | <20190319204247.GQ3908@calimero.vinschen.de> |
| Reply-To: | cygwin AT cygwin DOT com |
| Mail-Followup-To: | LRN <lrn1986 AT gmail DOT com>, cygwin AT cygwin DOT com |
| References: | <02f956fa-e872-87ba-9ab0-f10afc494a02 AT gmail DOT com> |
| MIME-Version: | 1.0 |
| In-Reply-To: | <02f956fa-e872-87ba-9ab0-f10afc494a02@gmail.com> |
| User-Agent: | Mutt/1.11.3 (2019-02-01) |
--WlEyl6ow+jlIgNUh
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable
On Mar 19 22: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.
>=20
> Tested with Cygwin-3.0.4.
> #include <wchar.h>
> #include <stdlib.h>
> #include <locale.h>
>=20
> int
> main ()
> {
> wchar_t w[2] =3D { L'z', L'\0' };
> setlocale (LC_ALL, "");
> int l =3D wcsxfrm (NULL, w, 0);
> return l;
> }
Thanks for the testcase. The problem has been introduced in commit
c0d7d3e1a2fa (*) when it turned out that combining the LCMAP_SORTKEY and
LCMAP_BYTEREV flags to LCMapStringW(**) were not such a good idea after
all. The fix at the time was to do the byte swap ourselves, but that
patch forgot to take a char count of 0 into account.
I pushed a patch and uploaded new developer snapshots to
https://cygwin.com/snapshots/
Pleas give them a try.
Thanks,
Corinna
(*) https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;a=3Dcommitd=
iff;h=3Dc0d7d3e1a2fa
(**) https://docs.microsoft.com/en-us/windows/desktop/api/winnls/nf-winnls-=
lcmapstringex
--=20
Corinna Vinschen
Cygwin Maintainer
--WlEyl6ow+jlIgNUh
Content-Type: application/pgp-signature; name="signature.asc"
-----BEGIN PGP SIGNATURE-----
iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlyRVEcACgkQ9TYGna5E
T6Dnbg//ZCkpsoCsNF+uGgKI818r8se951PpjZWlB0nqpFhve4QFXR76uGo4Rww/
BJ0lks6VNGgKbjhypqKq0eEBmEmMNY/csDWRIJ0VvcM5s6FiZC5lu1N927OE3Bde
WZGGocSPVUZVch7Ka80g86+74ZkJgn5ZQcpHN7cIoOnB75gAuOy6pvwm2ypimn/N
8QqteNqxA0IJkNXoqgHZ/EAyPxdGMAONilma0Ph28+k/yxPsdy5N95a5dQBVV94W
NsltEFnP6/KD47UwaDrcakXAB8Bjf97ISkCs78kYc029ASLMADXgYs11qUap7WSD
ezP2pmybe5IAaC6F+ughJqdk7IwOf71LDHsP108u1egAWswdIs1TWk4JGG8Qf0ZT
Y+ZZ2s3VfXIDaT2h1LvQotkELkNClF3XuqSco9Ul1KZkWQUeLFo1Dh4eW7xV+mdo
rlXxqzYom3c9ETrrgfHD6SOKQ+6Kz8KUuKz2dd5A80ZmYCyP8HvKKIjj3emBTfe3
5w3PbDO8wENd/HGa3cD/cnGR1EljPrP5PEk4kTzwaPfWMEOz9dPgUzkvAABnnaiF
bf1T6I5xzhpN1DgKDOjSUO+/WJe1DQi9P9C1xkqe8qqqgvHjFDHM8MJmIT+GlyEN
5EwAqJy1UkOueG6EuQnqjfIpq8Pmjlz6MPL/VSBLZE8bEC0Xl1M=
=3ZGX
-----END PGP SIGNATURE-----
--WlEyl6ow+jlIgNUh--
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |