From c77852c8916415b089e56271b6ab9f793fdb413c Mon Sep 17 00:00:00 2001 From: Nick Clifton Date: Mon, 16 Apr 2018 16:39:15 +0100 Subject: 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. --- gas/config/obj-elf.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gas/config/obj-elf.c') diff --git a/gas/config/obj-elf.c b/gas/config/obj-elf.c index 38b79f8..5870447 100644 --- a/gas/config/obj-elf.c +++ b/gas/config/obj-elf.c @@ -2471,7 +2471,8 @@ elf_adjust_symtab (void) sy = symbol_find_exact (group_name); if (!sy || (sy != symbol_lastP - && (sy->sy_next == NULL + && (sy->sy_flags.sy_local_symbol + || sy->sy_next == NULL || sy->sy_next->sy_previous != sy))) { /* Create the symbol now. */ -- cgit v1.1