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.
This commit is contained in:
Alan Modra 2020-08-30 20:27:27 +09:30
parent 2781f857e6
commit 54b8331d0b
2 changed files with 6 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2020-08-30 Alan Modra <amodra@gmail.com>
* readelf.c (print_gnu_build_attribute_name): Use unsigned long
long for "bytes".
2020-08-28 Nick Clifton <nickc@redhat.com>
PR 26548

View File

@ -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;