aboutsummaryrefslogtreecommitdiff
path: root/bfd/coff-rs6000.c
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/coff-rs6000.c
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/coff-rs6000.c')
-rw-r--r--bfd/coff-rs6000.c8
1 files changed, 4 insertions, 4 deletions
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;
}