From fb4041ae532fd21a82618c2be09898ea8979dec5 Mon Sep 17 00:00:00 2001 From: Mark Wielaard Date: Tue, 28 Apr 2015 13:56:15 +0200 Subject: [PATCH] elf.h SHF_EXCLUDE signed int 31 bit shift triggers undefined behaviour. Any use of SHF_EXCLUDE in code that tries to check it against sh_flags will trigger undefined behaviour because it is defined as a 31 bit shift against an signed integer. Fix by explicitly using an unsigned int. --- ChangeLog | 4 ++++ elf/elf.h | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 0e7a0a05b9..4b58951ab4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2015-04-28 Mark Wielaard + + * elf/elf.h (SHF_EXCLUDE): Use unsigned 1 for shift. + 2015-04-27 David S. Miller * sysdeps/unix/sysv/linux/sparc/sparc32/localplt.data: Remove diff --git a/elf/elf.h b/elf/elf.h index 71492a24d6..39bafc225c 100644 --- a/elf/elf.h +++ b/elf/elf.h @@ -371,7 +371,7 @@ typedef struct #define SHF_MASKPROC 0xf0000000 /* Processor-specific */ #define SHF_ORDERED (1 << 30) /* Special ordering requirement (Solaris). */ -#define SHF_EXCLUDE (1 << 31) /* Section is excluded unless +#define SHF_EXCLUDE (1U << 31) /* Section is excluded unless referenced or allocated (Solaris).*/ /* Section group handling. */ -- 2.11.4.GIT