aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2018-02-28 17:14:24 +1030
committerAlan Modra <amodra@gmail.com>2018-02-28 17:25:02 +1030
commit0d329c0a83a23cebb86fbe0ebddd780dc0df2424 (patch)
treeee22c2d2ce3b593e1172083587cf0f850ad46a77
parentf169cfdc08761a3d9fcd587ad8661102672403ec (diff)
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.
-rw-r--r--bfd/ChangeLog6
-rw-r--r--bfd/aoutx.h8
2 files changed, 13 insertions, 1 deletions
diff --git a/bfd/ChangeLog b/bfd/ChangeLog
index 59f7c9cfd48..446b978a7a8 100644
--- a/bfd/ChangeLog
+++ b/bfd/ChangeLog
@@ -1,3 +1,9 @@
+2018-02-28 Alan Modra <amodra@gmail.com>
+
+ PR 22887
+ * aoutx.h (translate_symbol_table): Print an error message and set
+ bfd_error on finding an invalid name string offset.
+
2018-02-27 H.J. Lu <hongjiu.lu@intel.com>
* config.in: Regenerated.
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 402b602ff45..4cadbfbd2fa 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->symbol.name = str + x;
else
- 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);