aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-08-27 13:25:31 +0930
committerAlan Modra <amodra@gmail.com>2020-08-27 21:56:33 +0930
commitcd570d497efca7b71ca999cb80d24bfcea5181ac (patch)
treef5cc593b55bd2736b349a5e924e3238677fd5538
parent2ac865acf01270240fecfb27180e65fc55513d83 (diff)
downloadgdb-cd570d497efca7b71ca999cb80d24bfcea5181ac.zip
gdb-cd570d497efca7b71ca999cb80d24bfcea5181ac.tar.gz
gdb-cd570d497efca7b71ca999cb80d24bfcea5181ac.tar.bz2
PR26462 UBSAN: reloc.c:473 shift exponent 4294967295
PR 26462 * reloc.c (bfd_check_overflow): Return early if zero bitsize.
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/reloc.c3
2 files changed, 8 insertions, 0 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 18ded26..6d3ba69 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2020-08-27 Alan Modra <amodra@gmail.com>
+ PR 26462
+ * reloc.c (bfd_check_overflow): Return early if zero bitsize.
+
+2020-08-27 Alan Modra <amodra@gmail.com>
+
* elf32-arm.c (elf32_arm_final_link_relocate): Don't segfault
on sym_sec not being output.
diff --git a/bfd/reloc.c b/bfd/reloc.c
index 9aba84c..7d3479a 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