delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/01/28/13:15:02

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.8 required=5.0 tests=AWL,BAYES_00,KAM_MX,SARE_SUB_PCT_LETTER,SPF_HELO_PASS,SPF_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4980A08E.5090102@redhat.com>
Date: Wed, 28 Jan 2009 13:14:38 -0500
From: Jeff Johnston <jjohnstn AT redhat DOT com>
User-Agent: Thunderbird 2.0.0.19 (X11/20090105)
MIME-Version: 1.0
To: newlib AT sourceware DOT org, cygwin AT cygwin DOT com
Subject: Re: [Fwd: Possible sscanf %f conversion glitch]
References: <20090128172422 DOT GA16129 AT calimero DOT vinschen DOT de>
In-Reply-To: <20090128172422.GA16129@calimero.vinschen.de>
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

Patch has been made.  The vfscanf code to look for "inf" and "nan" was 
not stopped if we
had only collected zeroes to that point so it thought it was processing 
an invalid infinity.

-- Jeff J.

Corinna Vinschen wrote:
> I'm forwarding this problem to the newlib list.  I checked against
> the latest Cygwin from CVS and the problem still exists, afaics.
>
> ----- Forwarded message from KHMan -----
>   
>> Date: Wed, 28 Jan 2009 23:19:07 +0800
>> From: KHMan
>> Subject: Possible sscanf %f conversion glitch
>> To: cygwin AT cygwin DOT com
>>
>> Hi all,
>>
>> Someone ran into a problem with sscanf %f conversion on the Lout list. It 
>> appeared that one specific case fails. I am running cygwin-1.5.25-15. Test 
>> cases:
>>
>> #include <stdio.h>
>> int main()
>> {
>>     char *foo1 = "10i";
>>     char *foo2 = "0i";
>>     char *foo3 = "0.0i";
>>     char *foo4 = "1.0i";
>>     char *foo5 = "0.1i";
>>     float f;
>>     printf("%d ", sscanf(foo1, "%f", &f)); printf("%f\n", f);
>>     printf("%d ", sscanf(foo2, "%f", &f)); printf("%f\n", f);
>>     printf("%d ", sscanf(foo3, "%f", &f)); printf("%f\n", f);
>>     printf("%d ", sscanf(foo4, "%f", &f)); printf("%f\n", f);
>>     printf("%d ", sscanf(foo5, "%f", &f)); printf("%f\n", f);
>> }
>>
>> As the scanf man page specifies, 'i' is not supposed to be converted, only 
>> the number part is supposed to be recognized.
>>
>> On Cygwin:
>> $ ./test
>> 1 10.000000
>> 0 10.000000
>> 1 0.000000
>> 1 1.000000
>> 1 0.100000
>>
>> On Linux (Ubuntu 8.04) and MinGW, the second case succeeds, the result 
>> being the same as the third case. I've done some googling, and haven't 
>> found anything related to this behaviour.
>>
>> -- 
>> Cheers,
>> Kein-Hong Man (esq.)
>> Kuala Lumpur, Malaysia
>>     
> ----- End forwarded message -----
>
>
> Corinna
>
>   


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

- Raw text -


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