NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: xsrc/58872: libXfont and libXfont2 fixes with ssp [patch]



The following reply was made to PR xsrc/58872; it has been noted by GNATS.

From: Nat Sloss <nathanialsloss%yahoo.com.au@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc: xsrc-manager%netbsd.org@localhost,
 gnats-admin%netbsd.org@localhost,
 netbsd-bugs%netbsd.org@localhost
Subject: Re: xsrc/58872: libXfont and libXfont2 fixes with ssp [patch]
Date: Wed, 4 Dec 2024 18:28:45 +1100

 Hi,
 
 If I printf (buffer) the value is valid. but it still crashes in atof
 
 
 if i print the buffer and print the value for x and XLFD_NDIGITS all is well, 
 and it works.
 
 Thats why I think its due to to optimization settings applied to the file -O2 
 instead of -O0.
 
 Best regards,
 
 Nat
 
 
 
 On Wed, 4 Dec 2024 17:55:01 Martin Husemann via gnats wrote:
 > The following reply was made to PR xsrc/58872; it has been noted by GNATS.
 > 
 > From: Martin Husemann <martin%duskware.de@localhost>
 > To: gnats-bugs%netbsd.org@localhost
 > Cc:
 > Subject: Re: xsrc/58872: libXfont and libXfont2 fixes with ssp [patch]
 > Date: Wed, 4 Dec 2024 07:51:52 +0100
 > 
 >  On Tue, Dec 03, 2024 at 11:20:02PM +0000, Nat Sloss via gnats wrote:
 >  >  +	volatile double result;
 >  >  
 >  >   	char buffer[40];
 >  >  
 >  >  -	sprintf(buffer, "%.*lg", XLFD_NDIGITS, x);
 >  >  -	return atof(buffer);
 > 
 >  How can a 40 char buffer be overrun with that format and XLFD_NDIGITS = 3?
 > 
 >  I would suggest to make the 40 depend on XLFD_NDIGITS, but that would be
 >  an upstream change (and not affect things here).
 > 
 >  Please capture a value where this overrun happens, turn it into a test
 > program and lets debug what goes wrong with your sprintf call.
 > 
 >  Martin
 


Home | Main Index | Thread Index | Old Index