Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sergei Trofimovich via Gdb-patches <gdb-patches@sourceware.org>
To: Simon Marchi <simon.marchi@polymtl.ca>
Cc: Sergei Trofimovich <siarheit@google.com>,
	binutils@sourceware.org, gdb-patches@sourceware.org
Subject: Re: [PATCH v2] gdb/nat/linux-osdata.c: fix build on gcc-12 (string overfow)
Date: Wed, 17 Nov 2021 08:29:02 +0000	[thread overview]
Message-ID: <20211117082852.28a50b9f@nz> (raw)
In-Reply-To: <c26a4f9e-4b49-c574-83a2-0e5e68e34aa1@polymtl.ca>

On Tue, 16 Nov 2021 20:09:57 -0500
Simon Marchi <simon.marchi@polymtl.ca> wrote:

> On 2021-11-16 18:55, Sergei Trofimovich wrote:
> > From: Sergei Trofimovich <siarheit@google.com>
> > 
> > On gcc-12 build fails as:
> > 
> >     ../../gdbserver/../gdb/nat/linux-osdata.c: In function 'void linux_xfer_osdata_processes(buffer*)':
> >     ../../gdbserver/../gdb/nat/linux-osdata.c:330:39: error:
> >       '__builtin___sprintf_chk' may write a terminating nul past the end of the destination [-Werror=format-overflow=]
> >       330 |                 sprintf (core_str, "%d", i);
> >           |                                       ^
> > 
> > It's an off-by-one case in an infeasible scenario for negative
> > huge core count. The change switches to std::string for memory
> > handling.
> > 
> > Tested by running 'info os processes' and checking CPU cores column.  
> 
> Thanks, this is ok.  Do you have push access, or do you want me to push
> it on your behalf?

Pushed as:
    https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=486f9e20e037f1eea2dce98dc393db60df5feef3

Thank you!

-- 

  Sergei

      reply	other threads:[~2021-11-17  8:31 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-16 23:55 Sergei Trofimovich via Gdb-patches
2021-11-17  1:09 ` Simon Marchi via Gdb-patches
2021-11-17  8:29   ` Sergei Trofimovich via Gdb-patches [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211117082852.28a50b9f@nz \
    --to=gdb-patches@sourceware.org \
    --cc=binutils@sourceware.org \
    --cc=siarheit@google.com \
    --cc=simon.marchi@polymtl.ca \
    --cc=slyich@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox