summaryrefslogtreecommitdiff
path: root/gas/stabs.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2018-04-16 16:39:15 +0100
committerNick Clifton <nickc@redhat.com>2018-04-16 16:39:15 +0100
commitc77852c8916415b089e56271b6ab9f793fdb413c (patch)
tree7a18a1c89e154da7ec5282448c5c63bcf49f9047 /gas/stabs.c
parentfc7aa874aad7eea29014c5591174d57f81500d69 (diff)
downloadbinutils-gdb-c77852c8916415b089e56271b6ab9f793fdb413c.tar.gz
Fix illegal memory accesses in the assembler when attempting to parse corrup tinput files.
PR 23054 * cond.c (s_ifsef): Replace use of obstack_copy with obstack_alloc followed by memcpy. (s_if, s_ifb, s_ifc, s_ifeqs): Likewise. * obj-elf.c (elf_adjust_symtab): Check for local symbols before attempting to dereference the sy_next field of a symbol. * stabs.c (get_stab_string_offset): Fail if there is no string following the stab directive.
Diffstat (limited to 'gas/stabs.c')
-rw-r--r--gas/stabs.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/gas/stabs.c b/gas/stabs.c
index 73d1361423c..d82de315433 100644
--- a/gas/stabs.c
+++ b/gas/stabs.c
@@ -202,6 +202,12 @@ s_stab_generic (int what,
int length;
string = demand_copy_C_string (&length);
+ if (string == NULL)
+ {
+ as_warn (_(".stab%c: missing string"), what);
+ ignore_rest_of_line ();
+ return;
+ }
/* FIXME: We should probably find some other temporary storage
for string, rather than leaking memory if someone else
happens to use the notes obstack. */