Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Fri, 7 Apr 2017 19:39:33 +0200
From: Joakim Sindholt <opensource@...sha.com>
To: musl@...ts.openwall.com
Subject: Re: Undefined behavior in sprintf(dest, "%lld", -1LL)

On Fri, Apr 07, 2017 at 02:35:20PM +0000, Pascal Cuoq wrote:
> > On 07 Apr 2017, at 16:26, Rich Felker <dalias@...c.org> wrote:
> > Does defining the ODD_TYPES macro fix the problem? My leaning is to
> > just remove that #ifdef logic and always use the correct type with
> > va_arg. All that was doing was saving a few bytes of code; the change
> > should not affect performance.
> 
> Yes, this fixes it. I had to add the following line to vfprintf.c:
> 
> #include <stddef.h>
> 
> because the type ptrdiff_t is used at line 151 in this variation of the code.
> 
> Thanks!
> 

Incidentally, I already have this patch lying around. The change makes
practically no difference in the code output (but the libc.a grows a few
bytes presumably because of DWARF data)

View attachment "0001-vfprintf-remove-dubious-optimization-ifdef.patch" of type "text/x-diff" (2563 bytes)

View attachment "oddtypes.diff" of type "text/plain" (5092 bytes)

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.