[PATCH] Avoid undefined behavior in __FD_MASK

Ondřej Bílka neleai@seznam.cz
Fri Feb 21 19:28:00 GMT 2014


On Mon, Feb 10, 2014 at 02:57:05PM +0100, Florian Weimer wrote:
> On 04/10/2013 09:45 AM, Florian Weimer wrote:
> >Shifting 1 into the sign position is supported by current GCC versions,
> >but the manual explicitly says this is subject to change.  __fd_mask
> >should really be an unsigned type, but changing that is more risky.  The
> >remaining bit operations should be safe.
> 
> I'd like to revive this patch:
> 
> <https://www.sourceware.org/ml/libc-alpha/2013-04/msg00295.html>
> 
> Changing the type of __fd_mask requires updates to the ABI
> testsuites. __fd_mask was added to them for a reason, I suppose, so
> I think adding the cast is the right way to address this.
> 
> -- 
> Florian Weimer / Red Hat Product Security Team

I am ok with cast.



More information about the Libc-alpha mailing list