mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-11-28 04:25:10 +08:00
PR26435, PR26436 UBSAN: elf32-cr16.c:928 left shift
PR 26435 PR 26436 * elf32-cr16.c (cr16_elf_final_link_relocate): Calculate reloc_bits without undefined behaviour.
This commit is contained in:
parent
c44ea3aef6
commit
34d8e6d0c5
@ -1,3 +1,10 @@
|
||||
2020-08-30 Alan Modra <amodra@gmail.com>
|
||||
|
||||
PR 26435
|
||||
PR 26436
|
||||
* elf32-cr16.c (cr16_elf_final_link_relocate): Calculate reloc_bits
|
||||
without undefined behaviour.
|
||||
|
||||
2020-08-29 Nick Clifton <nickc@redhat.com>
|
||||
|
||||
PR 26520
|
||||
|
@ -922,10 +922,7 @@ cr16_elf_final_link_relocate (reloc_howto_type *howto,
|
||||
as signed or unsigned. */
|
||||
check = Rvalue >> howto->rightshift;
|
||||
|
||||
/* Assumes two's complement. This expression avoids
|
||||
overflow if howto->bitsize is the number of bits in
|
||||
bfd_vma. */
|
||||
reloc_bits = (((1 << (howto->bitsize - 1)) - 1) << 1) | 1;
|
||||
reloc_bits = ((bfd_vma) 1 << (howto->bitsize - 1) << 1) - 1;
|
||||
|
||||
/* For GOT and GOTC relocs no boundary checks applied. */
|
||||
if (!((r_type == R_CR16_GOT_REGREL20)
|
||||
|
Loading…
Reference in New Issue
Block a user