This is the mail archive of the
mailing list for the GCC project.
Re: [PATCH] Avoid out of scope access in hsa-dump.c
On Sun, Jul 22 2018, Bernd Edlinger wrote:
> this fixes an use of a buffer after the block scope
> in hsa-dump.c: "buf" is assigned to "name" and used after
> the scope ends in a fprintf.
> I have not done any real checks, except boot-strapping with
> all languages.
> Is it OK for trunk?
I'd even say it's obvious. So yes, and thanks for spotting it!
> 2018-07-22 Bernd Edlinger <email@example.com>
> hsa-dump.c (dump_hsa_symbol): Avoid out of scope access to buf.
> Index: gcc/hsa-dump.c
> --- gcc/hsa-dump.c (revision 262904)
> +++ gcc/hsa-dump.c (working copy)
> @@ -776,11 +776,11 @@ static void
> dump_hsa_symbol (FILE *f, hsa_symbol *symbol)
> const char *name;
> + char buf;
> if (symbol->m_name)
> name = symbol->m_name;
> - char buf;
> sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),