This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] elf.h SHF_EXCLUDE signed int 31 bit shift triggers undefined behaviour.


On 04/22/2015 10:14 AM, Florian Weimer wrote:
> On 04/21/2015 11:20 AM, Mark Wielaard wrote:
>> -#define SHF_EXCLUDE	     (1 << 31)	/* Section is excluded unless
>> +#define SHF_EXCLUDE	     (1U << 31)	/* Section is excluded unless
> 
> I think the safer change is to use -0x80000000 as the value of the
> constant, without making it unsigned.  Otherwise my previous objections
> apply.

I thought some more about this, and have changed my opinion completely.
 Making the constant unsigned is less risky than making it negative
because of potential sign extension issues.  It's the lesser of two evils.

The proposed patch is okay with me.

-- 
Florian Weimer / Red Hat Product Security


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]