From: Alan Modra Date: Sun, 30 Aug 2020 10:57:27 +0000 (+0930) Subject: readelf: ubsan: shift exponent 32 is too large X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=54b8331d0b6b58d6f7256a22e7a9457d64891a43;p=binutils-gdb.git readelf: ubsan: shift exponent 32 is too large When compiled on a 32-bit host, a temp var is too small for possible 64-bit values to be calculated. * readelf.c (print_gnu_build_attribute_name): Make "bytes" unsigned long long. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ca9028688f9..9872504871b 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,8 @@ +2020-08-30 Alan Modra + + * readelf.c (print_gnu_build_attribute_name): Use unsigned long + long for "bytes". + 2020-08-28 Nick Clifton PR 26548 diff --git a/binutils/readelf.c b/binutils/readelf.c index f02848e4681..94aa876b5ae 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -19662,7 +19662,7 @@ print_gnu_build_attribute_name (Elf_Internal_Note * pnote) while (bytes --) { - unsigned long byte = (* name ++) & 0xff; + unsigned long long byte = *name++ & 0xff; val |= byte << shift; shift += 8;