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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=u0
	+TdSdT10Q83l/PTrO5i+wG6UBnj7u3ye3hgRSYmSPdNRHk8d74J+4kKeqIHJS3oD
	BIi+nwaxTyWBewO90uyFm76VEnqrVbUn6zInBSrwMBVke2W/Ko5G6i1qlKc7KR1X
	LeWnPJzEBVir+oUsCw/np/Zw5xLQremqFA9Je9ZXc=
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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=cdmazzId
	jRQ7EfbODDFKG/IBS/w=; b=oDARYj7EzRNL+a7G3RnwyJ/eDYyQMfeu7RHAxROm
	pRCCMfhsL28dibpCTcYxnizrGJtrgvs5yPKZX1BkzKKcILz3KPu3aNFcM+tWU7rn
	N/cHuwr4FWbzRIbpUKY0DKR/xdEXfqhUl17ioeA0qViwYDpxwLaKP8srnWHyr21g
	Alc=
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=-1.9 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2
X-HELO: mail-lb0-f172.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:in-reply-to:references:date         :message-id:subject:from:to:content-type;        bh=1pFMqXYFL2A9bLHdsweSY3LWxvbTMgSUvew8QxCEPVE=;        b=MVWLQIOp9Z1nXApRsaTt7+yw5qQ4OmpQnt4+1q8wqR+Fgpjlc/Ommj5tYA+r+xl85i         qfe2hnCNvjQ7lrHR3weliwb2LU7MOemsqLQOraUx6TOytdazixZmmVx7TlPK9pvtizq4         UPqBlw9WW2XH+7AYrY538xkiapTnhkzng+wOuVsVff/b0Vx33esW4tVVGdXnOnzWsq4Z         tZJVYUb3A52tHIZOoaIPDnGrDZTFOQkjIj7LBLapIokZJ9XVV/pM71CgljOSy2PVZyEw         EhTTE/zMxQx2shQNO4uoBLiKVphhxL1fnoP0tE4gV2IhlO4YEep0Mfdr3X65rZzDCtnL         4gQw==
X-Gm-Message-State: ALoCoQmKsZDNEhSYHTN5WomJLhzZNsIzPKmOqIUpdiWEQAAHpuNpwVOwntPhSJMMU556nD0bZw1T
MIME-Version: 1.0
X-Received: by 10.112.63.137 with SMTP id g9mr5053519lbs.121.1438373561559; Fri, 31 Jul 2015 13:12:41 -0700 (PDT)
In-Reply-To: <CAOC2fq89HuStOLzEO9MxFZHBd54vmYfvp4juQyMKkNGkYG_D_g@mail.gmail.com>
References: <CAOC2fq_fahjLapKbgO8Xer8neEjv1Ohs4bM3JOWcka0ajjcbCg@mail.gmail.com>	<55BA373A.4020909@dronecode.org.uk>	<55BB6F47.1000906@dronecode.org.uk>	<CAOC2fq89HuStOLzEO9MxFZHBd54vmYfvp4juQyMKkNGkYG_D_g@mail.gmail.com>
Date: Fri, 31 Jul 2015 13:12:41 -0700
Message-ID: <CAOC2fq-DHmzwkv5CcnqzQ-VG0fTy_5X0pnc6pPTWVbRvhOzaGQ@mail.gmail.com>
Subject: Re: Analyzing a SEG FAULT that gdb doesn't help with
From: Michael Enright <mike@kmcardiff.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

On Fri, Jul 31, 2015 at 11:46 AM, Michael Enright wrote:
> On Fri, Jul 31, 2015 at 5:51 AM, Jon TURNEY wrote:
>>
>> I think you need to use the gdb command 'set cygwin-exceptions on' to tell
>> gdb to break on exceptions <...>
>
> This is going to help, I have another application (which I don't even
> know yet if it uses strftime because I didn't write it) that is
> falling over in a similar fashion, with a different 0x61xxxxxx address
> involved.

The program in question is passing strings to printf that (a) end with
"% " or (b) in the middle have "% S". To be clear these strings are
the sole argument so they are format strings. This happens tons of
times during a run but eventually it crashes in printf, generating a
stackdump unless the magic setting is set.

As I read the posix spec, % can be followed by flags and space is
actually a flag. This flag affects how signs are handled for numeric
output. So it could be that the code is trying to deal with
%<flag><conversion-char> and S is not a valid conversion char. My
attempts to reproduce this outside the evil program have not worked.
The output is a little crazy when you printf("something % Something")
but in my test program it doesn't crash. I tried printing the strings
that the real program might have to deal with but this didn't cause a
crash either.

I have modified the evil program so that in at least this one spot,
lines from the input file are not passed to printf to be output.

So there might be something, because an internal SEGV that actually
halts the program is bad, but I haven't got a good test case. I have
always disagreed with both printf(sometext) and printf("%s", sometext)
as wastes of cycles but I wasn't the one making the choices when the
evil program was written.

--
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

