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.
This commit is contained in:
Nick Clifton
2018-04-16 16:39:15 +01:00
parent fc7aa874aa
commit c77852c891
4 changed files with 41 additions and 17 deletions

View File

@@ -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. */