binutils: Fix left shift of negative value.

This patch fixes all occurences of left-shifting negative constants in C code
which is undefined by the C standard.

binutils/ChangeLog:

        * dwarf.c (read_leb128): Fix left shift of negative value.
This commit is contained in:
Dominik Vogt 2015-11-09 17:12:56 +01:00 committed by Andreas Krebbel
parent 29f628db88
commit c4e0beacd7
2 changed files with 5 additions and 1 deletions

View File

@ -1,3 +1,7 @@
2015-11-09 Dominik Vogt <vogt@linux.vnet.ibm.com>
* dwarf.c (read_leb128): Fix left shift of negative value.
2015-11-03 Alan Modra <amodra@gmail.com>
* readelf (process_version_sections): Check DT_VERNEED and

View File

@ -292,7 +292,7 @@ read_leb128 (unsigned char *data,
*length_return = num_read;
if (sign && (shift < 8 * sizeof (result)) && (byte & 0x40))
result |= (dwarf_vma) -1 << shift;
result |= -((dwarf_vma) 1 << shift);
return result;
}