aboutsummaryrefslogtreecommitdiff
path: root/gas/dw2gencfi.c
diff options
context:
space:
mode:
authorNick Clifton <nickc@redhat.com>2019-05-10 16:57:31 +0100
committerNick Clifton <nickc@redhat.com>2019-05-14 10:42:25 +0100
commit3076e59490428c9719765f9b007d6d0d0238f006 (patch)
treecf5af362a3a1e16f2df44961241dc9b4d1cab77f /gas/dw2gencfi.c
parenta6d0f2490c0c7969eb60038f01c0ee0f46e4d5fd (diff)
downloadgdb-3076e59490428c9719765f9b007d6d0d0238f006.zip
gdb-3076e59490428c9719765f9b007d6d0d0238f006.tar.gz
gdb-3076e59490428c9719765f9b007d6d0d0238f006.tar.bz2
A series of fixes to addres problems detected by compiling the assembler with address sanitization enabled.
PR 24538 gas * macro.c (get_any_string): Increase size of buffer used to hold decimal value of expression result. * dw2gencfi.c (get_debugseg_name): Handle an empty name. * dwarf2dbg.c (get_filenum): Catch integer wraparound when extending allocate file array. (dwarf2_directive_filename): Add extra checks of the computed file number. * config/tc-arm.c (arm_tc_equal_in_insn): Insert copy of name into warning hash table. (s_arm_eabi_attribute): Check for obj_elf_vendor_attribute returning -1. * config/tc-i386.c (i386_output_nops): Catch an attempt to generate nops of negative lengths. * as.h (MAX_LITTLENUMS): Move definition to here from... * config/atof-ieee.c: ...here. * config/tc-aarch64.c: ...here. * config/tc-arc.c: ...here. * config/tc-arm.c: ...here. * config/tc-epiphany.c: ...here. * config/tc-i386.c: ...here. * config/tc-ia64.c: ...here. (And correct the value). * config/tc-m32c.c: ...here. * config/tc-m32r.c: ...here. * config/tc-metag.c: ...here. * config/tc-microblaze.c: ...here. * config/tc-nds32.c: ...here. * config/tc-or1k.c: ...here. * config/tc-score.c: ...here. * config/tc-score7.c: ...here. * config/tc-tic4x.c: ...here. * config/tc-tilegx.c: ...here. * config/tc-tilepro.c: ...here. * config/tc-visium.c: ...here. * config/tc-sh.c (md_assemble): Add check for an instruction with no opcodes. * config/tc-mips.c (mips_lookup_insn): Add check for very short instruction name. * config/tc-tic54x.c: Use unsigned chars to access is_end_of_line array. (tic54x_start_line_hook): Check for an empty line. (next_line_shows_parallel): Do not walk off the end of the string. (tic54x_macro_start): Check for too much macro nesting. (tic54x_start_label): Add label_start parameter. Use this parameter to check the first character of the label. * config/tc-tic54x.h (TC_START_LABEL_WITHOUT_COLON): Pass line_start variable to tic54x_start_label. PR 24538 opcodes * ia64-opc.c (ia64_find_matching_opcode): Check for reaching the end of the table prematurely.
Diffstat (limited to 'gas/dw2gencfi.c')
-rw-r--r--gas/dw2gencfi.c48
1 files changed, 24 insertions, 24 deletions
diff --git a/gas/dw2gencfi.c b/gas/dw2gencfi.c
index d85997b..f30734d 100644
--- a/gas/dw2gencfi.c
+++ b/gas/dw2gencfi.c
@@ -225,37 +225,37 @@ emit_expr_encoded (expressionS *exp, int encoding, bfd_boolean emit_encoding)
static char *
get_debugseg_name (segT seg, const char *base_name)
{
- const char *name;
+ const char * name;
+ const char * dollar;
+ const char * dot;
if (!seg)
- name = "";
- else
- {
- const char * dollar;
- const char * dot;
+ return concat (base_name, NULL);
- name = bfd_get_section_name (stdoutput, seg);
+ name = bfd_get_section_name (stdoutput, seg);
- dollar = strchr (name, '$');
- dot = strchr (name + 1, '.');
+ if (name == NULL || *name == 0)
+ return concat (base_name, NULL);
+
+ dollar = strchr (name, '$');
+ dot = strchr (name + 1, '.');
- if (!dollar && !dot)
- {
- if (!strcmp (base_name, ".eh_frame_entry")
- && strcmp (name, ".text") != 0)
- return concat (base_name, ".", name, NULL);
+ if (!dollar && !dot)
+ {
+ if (!strcmp (base_name, ".eh_frame_entry")
+ && strcmp (name, ".text") != 0)
+ return concat (base_name, ".", name, NULL);
- name = "";
- }
- else if (!dollar)
- name = dot;
- else if (!dot)
- name = dollar;
- else if (dot < dollar)
- name = dot;
- else
- name = dollar;
+ name = "";
}
+ else if (!dollar)
+ name = dot;
+ else if (!dot)
+ name = dollar;
+ else if (dot < dollar)
+ name = dot;
+ else
+ name = dollar;
return concat (base_name, name, NULL);
}