]> git.ipfire.org Git - thirdparty/elfutils.git/commitdiff
readelf.c (print_gdb_index_section): Use unsigned int for 31 bits left shift.
authorMark Wielaard <mjw@redhat.com>
Tue, 22 Apr 2014 20:23:18 +0000 (22:23 +0200)
committerMark Wielaard <mjw@redhat.com>
Thu, 24 Apr 2014 09:33:54 +0000 (11:33 +0200)
Found by gcc -fsanitize=undefined.
left shift of 1 by 31 places cannot be represented in type 'int'

Signed-off-by: Mark Wielaard <mjw@redhat.com>
src/ChangeLog
src/readelf.c

index 5eb69d60c8f07fc437b48dc0678a0806c6ec1ba4..874e2553e8db85e191e82a44551ed68882f510ad 100644 (file)
@@ -1,3 +1,8 @@
+2014-04-22  Mark Wielaard  <mjw@redhat.com>
+
+       * readelf.c (print_gdb_index_section): Use unsigned int for 31 bits
+       left shift.
+
 2014-03-13  Mark Wielaard  <mjw@redhat.com>
 
        * Makefile.am: Remove no_mudflap.os. Remove libmudflap from all
index 8a9543dc241e6f210dd8d4ed9cad0aee4bbc390c..da1bf73ab9cd65c87e22aa44a56fb865aaeab9b2 100644 (file)
@@ -7827,7 +7827,7 @@ print_gdb_index_section (Dwfl_Module *dwflmod, Ebl *ebl, GElf_Ehdr *ehdr,
              cu_kind = read_4ubyte_unaligned (dbg, readcus);
              cu = cu_kind & ((1 << 24) - 1);
              kind = (cu_kind >> 28) & 7;
-             is_static = cu_kind & (1 << 31);
+             is_static = cu_kind & (1U << 31);
              if (cu > cu_nr - 1)
                printf ("%" PRId32 "T", cu - (uint32_t) cu_nr);
              else