Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.BSM.4.64L.2407181733380.2401@herc.mirbsd.org>
Date: Thu, 18 Jul 2024 17:35:25 +0000 (UTC)
From: Thorsten Glaser <tg@...bsd.de>
To: musl@...ts.openwall.com
Subject: Re: [PATCH 1/1] FD_SET() and FD_ISSET() warn on -Wsign-conversion

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

Maybe this?

bye,
//mirabilos
-- 
Solange man keine schmutzigen Tricks macht, und ich meine *wirklich*
schmutzige Tricks, wie bei einer doppelt verketteten Liste beide
Pointer XORen und in nur einem Word speichern, funktioniert Boehm ganz
hervorragend.		-- Andreas Bogk über boehm-gc in d.a.s.r

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.