diff options
author | Alan Modra <amodra@gmail.com> | 2020-08-30 20:27:27 +0930 |
---|---|---|
committer | Alan Modra <amodra@gmail.com> | 2020-08-30 20:49:32 +0930 |
commit | 54b8331d0b6b58d6f7256a22e7a9457d64891a43 (patch) | |
tree | cdefbe493ca686e133f7930eac7a026ef066da1c | |
parent | 2781f857e6a654521f0decebb809989b72afa2c5 (diff) | |
download | gdb-54b8331d0b6b58d6f7256a22e7a9457d64891a43.zip gdb-54b8331d0b6b58d6f7256a22e7a9457d64891a43.tar.gz gdb-54b8331d0b6b58d6f7256a22e7a9457d64891a43.tar.bz2 |
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.
-rw-r--r-- | binutils/ChangeLog | 5 | ||||
-rw-r--r-- | binutils/readelf.c | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index ca90286..9872504 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -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 diff --git a/binutils/readelf.c b/binutils/readelf.c index f02848e..94aa876 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; |