aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2020-03-20 10:57:38 +1030
committerAlan Modra <amodra@gmail.com>2020-03-20 12:35:51 +1030
commit67338173a49204a2097ca1e2c63c6bc1fe972c3e (patch)
tree84fa706c61ea47287fb1987ef223adcb6b4ad260 /bfd
parent340f3ac8082771ecc473ab938fc3d7cbf607ddaa (diff)
downloadgdb-67338173a49204a2097ca1e2c63c6bc1fe972c3e.zip
gdb-67338173a49204a2097ca1e2c63c6bc1fe972c3e.tar.gz
gdb-67338173a49204a2097ca1e2c63c6bc1fe972c3e.tar.bz2
XCOFF uninitialized read
* coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large enough to read number of symbols.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog5
-rw-r--r--bfd/coff-rs6000.c8
2 files changed, 9 insertions, 4 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 6c2e26d..e04f008 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,5 +1,10 @@
2020-03-20 Alan Modra <amodra@gmail.com>
+ * coff-rs6000.c (_bfd_xcoff_slurp_armap): Ensure size is large
+ enough to read number of symbols.
+
+2020-03-20 Alan Modra <amodra@gmail.com>
+
* elf.c (_bfd_elf_setup_sections): Don't test known non-NULL
backend functions for NULL before calling.
(copy_special_section_fields, _bfd_elf_copy_private_bfd_data),
diff --git a/bfd/coff-rs6000.c b/bfd/coff-rs6000.c
index 2dd68e0..bf87596 100644
--- a/bfd/coff-rs6000.c
+++ b/bfd/coff-rs6000.c
@@ -1260,9 +1260,9 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
return FALSE;
GET_VALUE_IN_FIELD (sz, hdr.size, 10);
- if (sz == (bfd_size_type) -1)
+ if (sz + 1 < 5)
{
- bfd_set_error (bfd_error_no_memory);
+ bfd_set_error (bfd_error_bad_value);
return FALSE;
}
@@ -1322,9 +1322,9 @@ _bfd_xcoff_slurp_armap (bfd *abfd)
return FALSE;
GET_VALUE_IN_FIELD (sz, hdr.size, 10);
- if (sz == (bfd_size_type) -1)
+ if (sz + 1 < 9)
{
- bfd_set_error (bfd_error_no_memory);
+ bfd_set_error (bfd_error_bad_value);
return FALSE;
}