From: Alan Modra Date: Thu, 27 Aug 2020 03:55:31 +0000 (+0930) Subject: PR26462 UBSAN: reloc.c:473 shift exponent 4294967295 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=cd570d497efca7b71ca999cb80d24bfcea5181ac;p=binutils-gdb.git PR26462 UBSAN: reloc.c:473 shift exponent 4294967295 PR 26462 * reloc.c (bfd_check_overflow): Return early if zero bitsize. --- diff --git a/bfd/ChangeLog b/bfd/ChangeLog index 18ded261a57..6d3ba691da9 100644 --- a/bfd/ChangeLog +++ b/bfd/ChangeLog @@ -1,3 +1,8 @@ +2020-08-27 Alan Modra + + PR 26462 + * reloc.c (bfd_check_overflow): Return early if zero bitsize. + 2020-08-27 Alan Modra * elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault diff --git a/bfd/reloc.c b/bfd/reloc.c index 9aba84ca81e..7d3479acef4 100644 --- a/bfd/reloc.c +++ b/bfd/reloc.c @@ -466,6 +466,9 @@ bfd_check_overflow (enum complain_overflow how, bfd_vma fieldmask, addrmask, signmask, ss, a; bfd_reloc_status_type flag = bfd_reloc_ok; + if (bitsize == 0) + return flag; + /* Note: BITSIZE should always be <= ADDRSIZE, but in case it's not, we'll be permissive: extra bits in the field mask will automatically extend the address mask for purposes of the