diff options
Diffstat (limited to 'binutils/readelf.c')
-rw-r--r-- | binutils/readelf.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/binutils/readelf.c b/binutils/readelf.c index d4c4137..1139f71 100644 --- a/binutils/readelf.c +++ b/binutils/readelf.c @@ -15500,24 +15500,20 @@ process_mips_specific (FILE * file) if (ent == (bfd_vma) -1) goto got_print_fail; - if (data) - { - /* PR 21344 */ - if (data + ent - pltgot > data_end - addr_size) - { - error (_("Invalid got entry - %#lx - overflows GOT table\n"), - (long) ent); - goto got_print_fail; - } - - if (byte_get (data + ent - pltgot, addr_size) - >> (addr_size * 8 - 1) != 0) - { - ent = print_mips_got_entry (data, pltgot, ent, data_end); - printf (_(" Module pointer (GNU extension)\n")); - if (ent == (bfd_vma) -1) - goto got_print_fail; - } + /* Check for the MSB of GOT[1] being set, denoting a GNU object. + This entry will be used by some runtime loaders, to store the + module pointer. Otherwise this is an ordinary local entry. + PR 21344: Check for the entry being fully available before + fetching it. */ + if (data + && data + ent - pltgot + addr_size <= data_end + && (byte_get (data + ent - pltgot, addr_size) + >> (addr_size * 8 - 1)) != 0) + { + ent = print_mips_got_entry (data, pltgot, ent, data_end); + printf (_(" Module pointer (GNU extension)\n")); + if (ent == (bfd_vma) -1) + goto got_print_fail; } printf ("\n"); |