X-Recipient: archive-cygwin@delorie.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:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; q=dns; s=
	default; b=OgAx3fCuWcQ0rx0r8BWb+7SzmwX77hoQyrLviklOjYcvW6RiPPkWX
	V6WYWt+MaglG8MdrRXuM1Dv2Dn9me54VPIijXojjjNrWpF/vOhfM7gCgvc99Heek
	b1bY4h27Iv5DjwqkLoNioJ6223prDTza9OzmLgndEPyXYmdzzlniIk=
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:subject:message-id:reply-to
	:references:mime-version:content-type:in-reply-to; s=default;
	 bh=7Na0kcd3eoThMoaphgPZoLM8Wkw=; b=GLz9PRyPORQDy5xX7G5w/wWLcwlm
	AjJvl21OpR8DOtw7mmPb9iUFeCnWleOs5sE2ut4YEbsWmSzgvRS5U/8mNAzrkEAp
	KFeuF59tdM8ovNtkzXbMrd6d/apkdhBHjznWdZeOORJgWMdpTwGDijT6jdO1Ya02
	8rLhznmWDAVG+6k=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-5.4 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2
X-HELO: calimero.vinschen.de
Date: Mon, 3 Aug 2015 15:42:23 +0200
From: Corinna Vinschen <corinna-cygwin@cygwin.com>
To: cygwin@cygwin.com
Subject: Re: Seg Fault in strftime
Message-ID: <20150803134223.GB18434@calimero.vinschen.de>
Reply-To: cygwin@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
References: <CAOC2fq9A1DSjy=7Af=wVCkNEsttpd4Fj-0w_nNwnSb76WFt5WA@mail.gmail.com> <loom.20150801T233913-448@post.gmane.org> <CAOC2fq9Uv77EuBDBP=Eywht4DqmZZm05WPhnp4dU1V7cD+CE_g@mail.gmail.com> <20150803083634.GE17917@calimero.vinschen.de> <CAOC2fq-xQh8ThcvJBOMkWMfz0Y7b7FnhuHgBLaLSufLQY4qXGA@mail.gmail.com>
MIME-Version: 1.0
Content-Type: multipart/signed; micalg=pgp-sha256;	protocol="application/pgp-signature"; boundary="XOIedfhf+7KOe/yw"
Content-Disposition: inline
In-Reply-To: <CAOC2fq-xQh8ThcvJBOMkWMfz0Y7b7FnhuHgBLaLSufLQY4qXGA@mail.gmail.com>
User-Agent: Mutt/1.5.23 (2014-03-12)

--XOIedfhf+7KOe/yw
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Aug  3 03:54, Michael Enright wrote:
> On Mon, Aug 3, 2015 at 1:36 AM, Corinna Vinschen wrote:
> >
> > The core thingy in POSIX is "The <time.h> header shall declare the tm
> > structure, which shall include at least the following members:"
> >                                ^^^^^^^^
>=20
> I saw this language myself.
>=20
> >
> > A conforming application does not use such a structure which isn't
> > *at least* initialized to all 0 (memset).
> >
>=20
> I did NOT see any language that said anything about doing that. In any
> case, the code I'm using is in another Cygwin package, libmozjs185.

When having more members in a structure than defined as the minimum set
by POSIX, there's no way around that.

> > If your executable has been built prior to releasing this new code,
> > Cygwin won't require tm_zone and tm_gmtoff anyway.
>=20
> I have no idea how to interpret "has been build prior" in this case.

prior to the Cygwin version introducing the new members.  Same problem
as in Glibc.

> >  However, for later
> > built executables it will, and then there's no way around the crash
> > if tm_zone is uninitialized.  If it's NULL, you'll get the current
> > timezone.  But if it's not NULL it's suppsoed to be a pointer to
> > a valid string.  How is a library supposed to know that the pointer
> > value is just garbage?
>=20
> In the case where the spec does not say anything except the members
> shall include at least so-and-so, the library probably ought not to
> assume that it gets its implementation-defined members defined as
> inputs.
> [...]

Hang on.  So you suggest that Glibc, Cygwin, as well as any other
implementation based on the localtime.c code from Arthur David Olson,
stop using the additional struct members?  Despite them doing the right
thing where the POSIX implementation is lacking?  Because there's one
lib you need which doesn't work as expected, rather than rebuilding it
with a matching fix?  That doesn't sound overly convincing to me.

Other than that, you didn't answer the question:  How is a library
supposed to know that the non-NULL pointer value is just garbage?

I'm firmly with the GLibc guys here...


Corinna

--=20
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

--XOIedfhf+7KOe/yw
Content-Type: application/pgp-signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJVv2+/AAoJEPU2Bp2uRE+g890P/2Nio1y23XPm59x7wYnuP/UM
kKicpKImqqFhIkztMcQyz7eAOND9sCS5J53IWxoiDFHTsKRFHZPLFssbimy2PT5L
8v7Nh8m/p5u35sRUJNjPQANDil+aEGdpWGicK4RwBpDpiOszNiWBCFm8LIvTvq0g
T2uH7q2VySUw8wewe/9cPXxlNR8SxtmUXxyu2c5ozj12+oTu8qFxCa9VJ8Gb7oXh
LoUQ52U4rKv88r3QoqIUr0viVXC+uI6W5x6DhH9kg0BhlwQTnxxW5at7EVFy6d8d
63G5T4WJmQHx4JYIdH+3dbsyJeNfKQXlHySJfbHwGnjEzFN0bcUtgSjBvFhmPPhz
A6Uh0XSJtXGMRcyBgQkAbZNxFt7rJ90vZB6F3O306ia76cE3swJ0JPa9s57eJ/D6
rcfyZF47e47Fz7R1nWfG8bXTZqa7+oIJAueDhpAois2Xk1zDFgNKHiH3LF+miBTO
+bbAFpvgQrZGNSXg/UM4tVXP2TV3UATTeGn54mhUXBNKYer7OeHcJLwPnWNSzjpj
vEJsk4pDphkb6ox2obidzCNgzDoDMlxZCGmT9lP0zEh/4Rnf2qlihMf4EFwfkKpS
HGfefRl+idn6226dyiSF+YT5M4LUxtvPamROaHm43T2TPbBr8Cv+vCFdx/XtL55F
h1t2PREhsZTdvUvu9or6
=TjHD
-----END PGP SIGNATURE-----

--XOIedfhf+7KOe/yw--
