Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <d0cc9976-37e8-4289-9b66-ec75f272054d@brad-house.com>
Date: Thu, 1 Aug 2024 16:42:22 -0400
From: Brad House <brad@...d-house.com>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 1/1] FD_SET() and FD_ISSET() warn on
 -Wsign-conversion

On 8/1/24 3:06 PM, Brad House wrote:
> On 7/18/24 1:35 PM, Thorsten Glaser wrote:
>
>> Rich Felker dixit:
>>
>>> Use of signed ints generates worse code (not just bitshift/mask, needs
>>> fixup for C's wrong definition of signed integer division) and has
>>> more-dangerous behavior in the event of a negative input (small
>>> negative offset likely to clobber data in an exploitable way rather
>>> than giant positive offset likely to crash).
>> Aieee. I see, more reasons against signed integers in C :/
>>
>> #define FD_SET(d,s)    ((s)->fds_bits[(0U + (d)) / (8 * 
>> sizeof(long))] |= \
>>                 (1UL << ((0U + (d)) % (8 * sizeof(long)))))
>>
> Sorry it took me a while to reply on this.  But no, this doesn't 
> resolve the issue, it still emits the same warning.
>
> -Brad
>
As a follow-up, here's a new patch that [maybe?] resolves the issues you 
had with my first patch.

It uses static inlines to accomplish the task that should still provide 
relevant warnings to integrators.

Please see attached.

-Brad

View attachment "musl-fd_set-warning-fix-v2.patch" of type "text/plain" (1711 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.