dwarf2.c: read_abbrevs fail cleanup, and offset checking
authorAlan Modra <amodra@gmail.com>
Fri, 29 Nov 2019 22:42:29 +0000 (09:12 +1030)
committerAlan Modra <amodra@gmail.com>
Tue, 3 Dec 2019 05:35:40 +0000 (16:05 +1030)
commit019cc8758a68d016db920f96de3273a2824929d1
tree0936437a5a17c7aea43823eb52fcb646de79e1b8
parent1b8e12713b399450f8befc5f52442219f1f63669
dwarf2.c: read_abbrevs fail cleanup, and offset checking

read_section does offset checking, reporting an error on out of
bounds.  There's no need to duplicate the check in functions calling
read_section.  Also, I spotted a place where a pointer difference
expression was being cast to unsigned int, possibly truncating
relevant bits on a 64-bit host.

* dwarf2.c (read_indirect_string): Don't duplicate offset check
done in read_section.
(read_indirect_line_string): Likewise.
(read_alt_indirect_string): Likewise.
(read_alt_indirect_ref): Likewise.
(read_abbrevs): Likewise.  Free memory on all failure paths.
Use correct unsigned type for pointer difference comparison.
bfd/ChangeLog
bfd/dwarf2.c