From 33337736d0742c303766762611c83370d28268d7 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Mon, 15 Oct 2007 02:01:25 +0000 Subject: [PATCH] * read.c (do_s_func): Check asprintf return status. * stabs.c (stabs_generate_asm_func): Likewise. (stabs_generate_asm_endfunc): Likewise. --- gas/ChangeLog | 6 ++++++ gas/read.c | 10 ++++++++-- gas/stabs.c | 8 +++++--- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/gas/ChangeLog b/gas/ChangeLog index 82a5d364c3..407db4416e 100644 --- a/gas/ChangeLog +++ b/gas/ChangeLog @@ -1,3 +1,9 @@ +2007-10-15 Alan Modra + + * read.c (do_s_func): Check asprintf return status. + * stabs.c (stabs_generate_asm_func): Likewise. + (stabs_generate_asm_endfunc): Likewise. + 2007-10-12 H.J. Lu * config/tc-i386.c (process_operands): Simplify implicit xmm0 diff --git a/gas/read.c b/gas/read.c index baf85be39b..379b3f292a 100644 --- a/gas/read.c +++ b/gas/read.c @@ -5671,14 +5671,20 @@ do_s_func (int end_p, const char *default_prefix) if (*input_line_pointer != ',') { if (default_prefix) - asprintf (&label, "%s%s", default_prefix, name); + { + if (asprintf (&label, "%s%s", default_prefix, name) == -1) + as_fatal ("%s", xstrerror (errno)); + } else { char leading_char = bfd_get_symbol_leading_char (stdoutput); /* Missing entry point, use function's name with the leading char prepended. */ if (leading_char) - asprintf (&label, "%c%s", leading_char, name); + { + if (asprintf (&label, "%c%s", leading_char, name) == -1) + as_fatal ("%s", xstrerror (errno)); + } else label = name; } diff --git a/gas/stabs.c b/gas/stabs.c index 275a32792e..69cca1de4b 100644 --- a/gas/stabs.c +++ b/gas/stabs.c @@ -669,8 +669,9 @@ stabs_generate_asm_func (const char *funcname, const char *startlabname) } as_where (&file, &lineno); - asprintf (&buf, "\"%s:F1\",%d,0,%d,%s", - funcname, N_FUN, lineno + 1, startlabname); + if (asprintf (&buf, "\"%s:F1\",%d,0,%d,%s", + funcname, N_FUN, lineno + 1, startlabname) == -1) + as_fatal ("%s", xstrerror (errno)); input_line_pointer = buf; s_stab ('s'); free (buf); @@ -695,7 +696,8 @@ stabs_generate_asm_endfunc (const char *funcname ATTRIBUTE_UNUSED, ++label_count; colon (sym); - asprintf (&buf, "\"\",%d,0,0,%s-%s", N_FUN, sym, startlabname); + if (asprintf (&buf, "\"\",%d,0,0,%s-%s", N_FUN, sym, startlabname) == -1) + as_fatal ("%s", xstrerror (errno)); input_line_pointer = buf; s_stab ('s'); free (buf); -- 2.11.0