public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Sebor <msebor@gmail.com>
To: Jeff Law <law@redhat.com>, Gcc Patch List <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] relax -Wformat-overflow for precision ranges (PR 79275)
Date: Thu, 02 Feb 2017 17:13:00 -0000	[thread overview]
Message-ID: <7272b85a-973a-604c-d4a9-35c6a3c1f440@gmail.com> (raw)
In-Reply-To: <45ff5b64-c46c-c18e-38b8-586ef3f7eca9@redhat.com>

>>> My general inclination is to ask this to wait for gcc-8 as it is not a
>>> regression, but instead a false positive in a new warning.
> So as I mentioned in my message to Joseph, I'm going to go with Joseph &
> Jakub's view that this should be considered a regression.

Okay.  I'll wait for your approval of the patch then (with the fix
for the typo you pointed out).

>> My biggest concern with being more aggressive than that (besides
>> the pushback) is that I can't think of a good function to compute
>> the size (it can't very well be a constant).
> Presumably the argument against simply giving up and not checking at all
> is that by assuming length 1, we can still check all the other arguments
> and perhaps still give a warning if the sprintf overflows when the
> unbound string is essentially ignored?

That's right.  Since assuming the length of an unknown string is zero
is always safe, ignoring the rest of the format when one is found never
even crossed my mind.  There are other problems we can find if we keep
going that don't necessarily depend on our knowledge of the string
length.  (E.g., excessive widths and precisions, null string pointers,
or even unterminated character arrays if/when that is implemented,
etc.)

Martin

  reply	other threads:[~2017-02-02 17:13 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-30 21:31 Martin Sebor
2017-01-31 22:35 ` Jeff Law
2017-01-31 22:46   ` Jakub Jelinek
2017-01-31 23:00     ` Jeff Law
2017-01-31 23:22   ` Joseph Myers
2017-02-02 16:40     ` Jeff Law
2017-02-02  0:40   ` Martin Sebor
2017-02-02 16:54     ` Jeff Law
2017-02-02 17:13       ` Martin Sebor [this message]
2017-02-02 17:26 ` Jeff Law
2017-02-02 18:00   ` Martin Sebor
2017-02-02 18:09     ` Marek Polacek
2017-02-02 18:34       ` Jeff Law

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=7272b85a-973a-604c-d4a9-35c6a3c1f440@gmail.com \
    --to=msebor@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).