public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Steffen Prohaska <prohaska@zib•de>
Cc: git@vger•kernel.org
Subject: Re: [PATCH] sha1_file: don't convert off_t to size_t too early to avoid potential die()
Date: Mon, 22 Sep 2014 10:49:31 -0700	[thread overview]
Message-ID: <xmqqfvfjlf4k.fsf@gitster.dls.corp.google.com> (raw)
In-Reply-To: <1411293806-3087-1-git-send-email-prohaska@zib.de> (Steffen Prohaska's message of "Sun, 21 Sep 2014 12:03:26 +0200")

Steffen Prohaska <prohaska@zib•de> writes:

> xsize_t() checks if an off_t argument can be safely converted to
> a size_t return value.  If the check is executed too early, it could
> fail for large files on 32-bit architectures even if the size_t code
> path is not taken.  Other paths might be able to handle the large file.
> Specifically, index_stream_convert_blob() is able to handle a large file
> if a filter is configured that returns a small result.
>
> Signed-off-by: Steffen Prohaska <prohaska@zib•de>
> ---
>
> This patch should be applied on top of sp/stream-clean-filter.
>
> index_stream() might internally also be able to handle large files to
> some extent.  But it uses size_t for its third argument, and we must
> already die() when calling it.  It might be a good idea to convert its
> interface to use off_t and push the size checks further down the stack.

Yes, if we want to futz in this area, I think that would be the
right approach.

  reply	other threads:[~2014-09-22 17:49 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-21 10:03 [PATCH] sha1_file: don't convert off_t to size_t too early to avoid potential die() Steffen Prohaska
2014-09-22 17:49 ` Junio C Hamano [this message]
2014-09-22 19:41 ` Junio C Hamano

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=xmqqfvfjlf4k.fsf@gitster.dls.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=prohaska@zib$(echo .)de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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