git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jeff King <peff@peff.net>
To: Thomas Gummerer <t.gummerer@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [PATCH] ls-files: use correct format string
Date: Thu, 11 Apr 2019 00:18:24 -0400	[thread overview]
Message-ID: <20190411041823.GA17699@sigill.intra.peff.net> (raw)
In-Reply-To: <20190407184751.28027-1-t.gummerer@gmail.com>

On Sun, Apr 07, 2019 at 07:47:51PM +0100, Thomas Gummerer wrote:

> struct stat_data and struct cache_time both use unsigned ints for all
> their members.  However the format string for 'git ls-files --debug'
> currently uses %d for formatting these numbers.  This means that we
> potentially print these values incorrectly if they are greater than
> INT_MAX.
> 
> This has been the case since the --debug option was introduced in 'git
> ls-files' in 8497421715 ("ls-files: learn a debugging dump format",
> 2010-07-31).

I didn't see any comment on this, but it seems like it must be obviously
correct, since as you note we do define those fields as unsigned. I'm
really surprised that -Wformat doesn't catch this, though. I wonder why.

-Peff

  reply	other threads:[~2019-04-11  4:18 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-07 18:47 [PATCH] ls-files: use correct format string Thomas Gummerer
2019-04-11  4:18 ` Jeff King [this message]
2019-04-11 21:28   ` Thomas Gummerer
2019-04-11 23:49     ` Jeff King

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=20190411041823.GA17699@sigill.intra.peff.net \
    --to=peff@peff.net \
    --cc=git@vger.kernel.org \
    --cc=t.gummerer@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;
as well as URLs for NNTP newsgroup(s).