diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-26 11:00:22 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-26 23:23:44 +0930 |
commit | 1673aff56987e560ab429beba0d77b85a1c4e064 (patch) | |
tree | 36a188149c96a328c30da6adc270e4be2b2d4590 /include/elf | |
parent | 66ad6b4458091b6bb7fbc327308ceabaaba02e8b (diff) | |
download | gdb-1673aff56987e560ab429beba0d77b85a1c4e064.zip gdb-1673aff56987e560ab429beba0d77b85a1c4e064.tar.gz gdb-1673aff56987e560ab429beba0d77b85a1c4e064.tar.bz2 |
PR26458 UBSAN: elf32-i386.c:3615 left shift of negative value
Happens when poking symbol index -2 into r_info. (The index is
updated before writing out to file.)
PR 26458
* elf/common.h (ELF32_R_INFO): Cast symbol index to unsigned.
Diffstat (limited to 'include/elf')
-rw-r--r-- | include/elf/common.h | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/include/elf/common.h b/include/elf/common.h index 2138868..efef412 100644 --- a/include/elf/common.h +++ b/include/elf/common.h @@ -942,7 +942,7 @@ #define ELF32_R_SYM(i) ((i) >> 8) #define ELF32_R_TYPE(i) ((i) & 0xff) -#define ELF32_R_INFO(s,t) (((s) << 8) + ((t) & 0xff)) +#define ELF32_R_INFO(s,t) (((unsigned) (s) << 8) + ((t) & 0xff)) #define ELF64_R_SYM(i) ((i) >> 32) #define ELF64_R_TYPE(i) ((i) & 0xffffffff) |