aboutsummaryrefslogtreecommitdiff
path: root/bfd/aoutx.h
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2016-12-01 10:49:39 +0000
committerNick Clifton <nickc@redhat.com>2016-12-01 10:49:39 +0000
commite82ab856bb4689330c29fb9f1c57a8555b26380e (patch)
tree5f6c9a35eefed4a2c7b501c55872773e5d9af9a5 /bfd/aoutx.h
parent6d6ad65b43efa17a825702297331fcb290445a18 (diff)
downloadgdb-e82ab856bb4689330c29fb9f1c57a8555b26380e.zip
gdb-e82ab856bb4689330c29fb9f1c57a8555b26380e.tar.gz
gdb-e82ab856bb4689330c29fb9f1c57a8555b26380e.tar.bz2
Fix a seg-fault disassembling a corrupt binary.
PR binutils/20892 * aoutx.h (find_nearest_line): Handle the case where the function name is empty.
Diffstat (limited to 'bfd/aoutx.h')
-rw-r--r--bfd/aoutx.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/bfd/aoutx.h b/bfd/aoutx.h
index 614da21..4308679 100644
--- a/bfd/aoutx.h
+++ b/bfd/aoutx.h
@@ -2830,6 +2830,12 @@ NAME (aout, find_nearest_line) (bfd *abfd,
const char *function = func->name;
char *colon;
+ if (buf == NULL)
+ {
+ /* PR binutils/20892: In a corrupt input file func can be empty. */
+ * functionname_ptr = NULL;
+ return TRUE;
+ }
/* The caller expects a symbol name. We actually have a
function name, without the leading underscore. Put the
underscore back in, so that the caller gets a symbol name. */