This is the mail archive of the mailing list for the binutils project.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Nonsense error messages on invalid aout string offset

translate_symbol_table returns false on detecting an out of range name
string offset, hooray for error checking, but doesn't set bfd_error or
print a useful error.  bfd_error therefore contains whatever it had
previously, in my testing, bfd_error_system_call.  So the error
printed depended on errno.

	PR 22887
	* aoutx.h (translate_symbol_table): Print an error message and set
	bfd_error on finding an invalid name string offset.

diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 402b602..4cadbfb 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -1734,7 +1734,13 @@ NAME (aout, translate_symbol_table) (bfd *abfd,
       else if (x < strsize)
 	in-> = str + x;
-	return FALSE;
+	{
+	  _bfd_error_handler
+	    (_("%pB: invalid string offset %" PRIu64 " >= %" PRIu64),
+	     abfd, (uint64_t) x, (uint64_t) strsize);
+	  bfd_set_error (bfd_error_bad_value);
+	  return FALSE;
+	}
       in->symbol.value = GET_SWORD (abfd,  ext->e_value);
       in->desc = H_GET_16 (abfd, ext->e_desc);

Alan Modra
Australia Development Lab, IBM

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]