readelf: mask unknown description data bytes.

When printing unknown note types, readelf prints the raw description
section byte-by-byte. However, it does not mask appropriately, e.g. it
prints the byte 'ba' as 'ffffffba'.

	* readelf.c (process_note): Mask unknown description data bytes.
This commit is contained in:
Jordan Rupprecht via binutils 2019-08-07 13:48:14 -07:00 committed by Alan Modra
parent b1791af06e
commit 178d871928
2 changed files with 5 additions and 1 deletions

View file

@ -1,3 +1,7 @@
2019-08-08 Jordan Rupprecht <rupprecht@google.com>
* readelf.c (process_note): Mask unknown description data bytes.
2019-08-08 Alan Modra <amodra@gmail.com>
* readelf.c (get_data): Improve overflow checks.

View file

@ -19115,7 +19115,7 @@ process_note (Elf_Internal_Note * pnote,
printf (_(" description data: "));
for (i = 0; i < pnote->descsz; i++)
printf ("%02x ", pnote->descdata[i]);
printf ("%02x ", pnote->descdata[i] & 0xff);
if (!do_wide)
printf ("\n");
}