aboutsummaryrefslogtreecommitdiff
path: root/bfd/elf32-xtensa.c
diff options
context:
space:
mode:
authorGuillermo E. Martinez <guillermo.e.martinez@oracle.com>2021-10-07 16:19:13 +1030
committerAlan Modra <amodra@gmail.com>2021-10-09 14:02:07 +1030
commit0161bdd47ca9c06500ca2be83b3be2976900628e (patch)
tree7fb752f3f975d916b46b06d7deb0cd1d1c8afe67 /bfd/elf32-xtensa.c
parent851a4f24d7848489e12374550cf5c8e05fa617e7 (diff)
downloadgdb-0161bdd47ca9c06500ca2be83b3be2976900628e.zip
gdb-0161bdd47ca9c06500ca2be83b3be2976900628e.tar.gz
gdb-0161bdd47ca9c06500ca2be83b3be2976900628e.tar.bz2
PR28415, invalid read in xtensa_read_table_entries
PR 28415 PR 28416 * elf32-xtensa.c (xtensa_read_table_entries): Handle error return from retrieve_contents.
Diffstat (limited to 'bfd/elf32-xtensa.c')
-rw-r--r--bfd/elf32-xtensa.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/bfd/elf32-xtensa.c b/bfd/elf32-xtensa.c
index e5bfbb2..dc5b2d3 100644
--- a/bfd/elf32-xtensa.c
+++ b/bfd/elf32-xtensa.c
@@ -910,7 +910,14 @@ xtensa_read_table_entries (bfd *abfd,
table_entry_size -= 4;
num_records = table_size / table_entry_size;
+
table_data = retrieve_contents (abfd, table_section, true);
+ if (table_data == NULL)
+ {
+ *table_p = NULL;
+ return 0;
+ }
+
blocks = (property_table_entry *)
bfd_malloc (num_records * sizeof (property_table_entry));
block_count = 0;