aboutsummaryrefslogtreecommitdiff
path: root/bfd
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1996-09-17 18:20:06 +0000
committerIan Lance Taylor <ian@airs.com>1996-09-17 18:20:06 +0000
commit7f21c97c444fee0e10ff0e6a3c6737d9a3a4633a (patch)
tree3b97db7e072d10385804828b56e64470f47f77ec /bfd
parent88907d73efe4b270d76730bbd343c839c2518aea (diff)
downloadgdb-7f21c97c444fee0e10ff0e6a3c6737d9a3a4633a.zip
gdb-7f21c97c444fee0e10ff0e6a3c6737d9a3a4633a.tar.gz
gdb-7f21c97c444fee0e10ff0e6a3c6737d9a3a4633a.tar.bz2
* coffcode.h (coff_slurp_line_table): Warn about illegal symbol
indices, rather than crashing. (coff_slurp_reloc_table): Likewise. Check whether the howto field is NULL.
Diffstat (limited to 'bfd')
-rw-r--r--bfd/ChangeLog7
-rw-r--r--bfd/coffcode.h52
2 files changed, 49 insertions, 10 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 5718b14..4bac85b 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,10 @@
+Tue Sep 17 14:18:31 1996 Ian Lance Taylor <ian@cygnus.com>
+
+ * coffcode.h (coff_slurp_line_table): Warn about illegal symbol
+ indices, rather than crashing.
+ (coff_slurp_reloc_table): Likewise. Check whether the howto field
+ is NULL.
+
Mon Sep 16 12:39:36 1996 Ian Lance Taylor <ian@cygnus.com>
* coff-arm.c (aoutarm_std_reloc_howto): Change dst_mask for ARM26D
diff --git a/bfd/coffcode.h b/bfd/coffcode.h
index 8de83a5..508f75e 100644
--- a/bfd/coffcode.h
+++ b/bfd/coffcode.h
@@ -2986,7 +2986,7 @@ coff_set_section_contents (abfd, section, location, offset, count)
if (abfd->output_has_begun == false) /* set by bfd.c handler */
coff_compute_section_file_positions (abfd);
-#ifdef _LIB
+#if defined(_LIB) && !defined(TARG_AUX)
/* The physical address field of a .lib section is used to hold the
number of shared libraries in the section. This code counts the
@@ -3138,11 +3138,27 @@ coff_slurp_line_table (abfd, asect)
if (cache_ptr->line_number == 0)
{
- coff_symbol_type *sym =
- (coff_symbol_type *) (dst.l_addr.l_symndx
- + obj_raw_syments (abfd))->u.syment._n._n_n._n_zeroes;
+ boolean warned;
+ long symndx;
+ coff_symbol_type *sym;
+
+ warned = false;
+ symndx = dst.l_addr.l_symndx;
+ if (symndx < 0 || symndx >= obj_raw_syment_count (abfd))
+ {
+ (*_bfd_error_handler)
+ ("%s: warning: illegal symbol index %ld in line numbers",
+ bfd_get_filename (abfd), dst.l_addr.l_symndx);
+ symndx = 0;
+ warned = true;
+ }
+ /* FIXME: We should not be casting between ints and
+ pointers like this. */
+ sym = ((coff_symbol_type *)
+ ((symndx + obj_raw_syments (abfd))
+ ->u.syment._n._n_n._n_zeroes));
cache_ptr->u.sym = (asymbol *) sym;
- if (sym->lineno != NULL)
+ if (sym->lineno != NULL && ! warned)
{
(*_bfd_error_handler)
("%s: warning: duplicate line number information for `%s'",
@@ -3604,11 +3620,20 @@ coff_slurp_reloc_table (abfd, asect, symbols)
if (dst.r_symndx != -1)
{
- /* @@ Should never be greater than count of symbols! */
- if (dst.r_symndx >= obj_conv_table_size (abfd))
- abort ();
- cache_ptr->sym_ptr_ptr = symbols + obj_convert (abfd)[dst.r_symndx];
- ptr = *(cache_ptr->sym_ptr_ptr);
+ if (dst.r_symndx < 0 || dst.r_symndx >= obj_conv_table_size (abfd))
+ {
+ (*_bfd_error_handler)
+ ("%s: warning: illegal symbol index %ld in relocs",
+ bfd_get_filename (abfd), dst.r_symndx);
+ cache_ptr->sym_ptr_ptr = bfd_abs_section_ptr->symbol_ptr_ptr;
+ ptr = 0;
+ }
+ else
+ {
+ cache_ptr->sym_ptr_ptr = (symbols
+ + obj_convert (abfd)[dst.r_symndx]);
+ ptr = *(cache_ptr->sym_ptr_ptr);
+ }
}
else
{
@@ -3633,6 +3658,13 @@ coff_slurp_reloc_table (abfd, asect, symbols)
RTYPE2HOWTO (cache_ptr, &dst);
#endif
+ if (cache_ptr->howto == NULL)
+ {
+ (*_bfd_error_handler)
+ ("%s: illegal relocation type %d at address 0x%lx",
+ bfd_get_filename (abfd), dst.r_type, (long) dst.r_vaddr);
+ return false;
+ }
}
asect->relocation = reloc_cache;