PR26462 UBSAN: reloc.c:473 shift exponent 4294967295

Alan Modra amodra@gmail.com
Thu Aug 27 12:31:00 GMT 2020


	PR 26462
	* reloc.c (bfd_check_overflow): Return early if zero bitsize.

diff --git a/bfd/reloc.c b/bfd/reloc.c
index 9aba84ca81..7d3479acef 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

-- 
Alan Modra
Australia Development Lab, IBM


More information about the Binutils mailing list