public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "jakub at gcc dot gnu.org" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug middle-end/54582] gap in FORTIFY checking of buffer lengths
Date: Wed, 06 Feb 2013 12:41:00 -0000	[thread overview]
Message-ID: <bug-54582-4-Ai9DeIdDBe@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-54582-4@http.gcc.gnu.org/bugzilla/>


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54582

Jakub Jelinek <jakub at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |jakub at gcc dot gnu.org

--- Comment #5 from Jakub Jelinek <jakub at gcc dot gnu.org> 2013-02-06 12:41:09 UTC ---
It isn't that easy.  For %'s you really have to parse all the characters after
% and figure out where the format specifier ends.  Users can have printf hooks
installed, so it certainly needs to give up any time it sees something it
doesn't fully understand.  In that case I guess it could safely just assume the
lower bound as if the string ended on the % after which it doesn't understand
the letters.  Note, that this is just about the compile time warning, the code
will fail at runtime the same way in the first as in the second case.

So, if we are going to do something about this, either we could do something
very simple, like strchr (str, '%') - str as low bound guess, or reuse the
c-format tables somehow (but they are in the FE, while this is in middle-end),
or write a simple parse of few most common formatting specifiers and give up on
anything else.


  parent reply	other threads:[~2013-02-06 12:41 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-09-14 19:48 [Bug c/54582] New: " dcb314 at hotmail dot com
2012-09-17  8:51 ` [Bug c/54582] " rguenth at gcc dot gnu.org
2013-02-06 10:58 ` dcb314 at hotmail dot com
2013-02-06 12:18 ` [Bug middle-end/54582] " rguenth at gcc dot gnu.org
2013-02-06 12:21 ` rguenth at gcc dot gnu.org
2013-02-06 12:41 ` jakub at gcc dot gnu.org [this message]
2013-02-06 13:14 ` manu at gcc dot gnu.org
2013-02-06 13:26 ` jakub at gcc dot gnu.org
2013-02-06 13:40 ` manu at gcc dot gnu.org
2013-02-06 13:47 ` jakub at gcc dot gnu.org
2013-02-06 14:29 ` fweimer at redhat dot com
2013-02-06 18:48 ` dcb314 at hotmail dot com
2013-02-07 21:19 ` dcb314 at hotmail dot com
2013-02-07 21:22 ` dcb314 at hotmail dot com
2013-02-14 19:07 ` dcb314 at hotmail dot com
2013-03-08  8:49 ` dcb314 at hotmail dot com

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=bug-54582-4-Ai9DeIdDBe@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).