* coff-mcore.c (coff_mcore_relocate_section): Sanity check sym
string offset when setting up name for use by error messages.
* coff-sh.c (sh_relocate_section): Likewise.
my_name = "*unknown*";
else if ( sym->_n._n_n._n_zeroes == 0
&& sym->_n._n_n._n_offset != 0)
- my_name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
+ {
+ if (sym->_n._n_n._n_offset < obj_coff_strings_len (input_bfd))
+ my_name = (obj_coff_strings (input_bfd)
+ + sym->_n._n_n._n_offset);
+ else
+ my_name = "?";
+ }
else
{
strncpy (buf, sym->_n._n_name, SYMNMLEN);
name = NULL;
else if (sym->_n._n_n._n_zeroes == 0
&& sym->_n._n_n._n_offset != 0)
- name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
+ {
+ if (sym->_n._n_n._n_offset < obj_coff_strings_len (input_bfd))
+ name = obj_coff_strings (input_bfd) + sym->_n._n_n._n_offset;
+ else
+ name = "?";
+ }
else
{
strncpy (buf, sym->_n._n_name, SYMNMLEN);