This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Avoid out of scope access in hsa-dump.c
- From: Bernd Edlinger <bernd dot edlinger at hotmail dot de>
- To: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Martin Jambor <mjambor at suse dot cz>
- Date: Sun, 22 Jul 2018 19:09:38 +0000
- Subject: [PATCH] Avoid out of scope access in hsa-dump.c
Hi,
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?
Thanks
Bernd.
2018-07-22 Bernd Edlinger <bernd.edlinger@hotmail.de>
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[64];
if (symbol->m_name)
name = symbol->m_name;
else
{
- char buf[64];
sprintf (buf, "__%s_%i", hsa_seg_name (symbol->m_segment),
symbol->m_name_number);