public inbox for git@vger.kernel.org 
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox•com>
To: Jeff King <peff@peff•net>
Cc: Jacek Wielemborek <d33tah@gmail•com>, git@vger•kernel.org
Subject: Re: Segmentation fault found while fuzzing .pack file under 2.7.0.rc3
Date: Wed, 24 Feb 2016 10:48:27 -0800	[thread overview]
Message-ID: <xmqqegc2t05g.fsf@gitster.mtv.corp.google.com> (raw)
In-Reply-To: <20160224110548.GA21620@sigill.intra.peff.net> (Jeff King's message of "Wed, 24 Feb 2016 06:05:48 -0500")

Jeff King <peff@peff•net> writes:

> On Thu, Jan 07, 2016 at 02:54:50PM -0800, Junio C Hamano wrote:
>
>> We do not check if the offset of individual objects are within the
>> corresponding .pack file, either, and nth_packed_object_offset()
>> does return the data read from .idx file that is not checked for
>> sanity.  use_pack(), which is the helper used by the callers of
>> nth_packed_object_offset() that finds the offset in the packfile for
>> each object, avoids allowing a read access to mapped pack data
>> beyond the end of it, so it is OK to return bogus value that was
>> read from the .idx file from this function, but there is one
>> computation the function itself does using a possibly bogus value
>> read from the disk: to find out where in the secondary offset table
>> in the .idx file the offset in the packfile is stored.
>
> Looks like this topic got dropped. I was reminded of it when somebody
> pointed me to a similar case[1] today which segfaults in a similar way (but
> this time was caused by actual filesystem corruption).
>
> Did you ever push the patch below further along?

I do not think so, as I didn't "dig"; I recall trying to be explicit
that it was an illustration to prevent two extra and unnecessary
changes I alluded to in the earlier parts of the thread, not a real
patch.

> I confirmed that your patch detects and complains on this newer case.
> Though I think there is another similar problem in
> read_v2_anomalous_offsets (I haven't dug, but it triggers for me in
> "index-pack --verify").
>
> -Peff
>
> [1] https://github.com/libgit2/libgit2/issues/3556

  reply	other threads:[~2016-02-24 18:48 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-01-05 13:44 Segmentation fault found while fuzzing .pack file under 2.7.0.rc3 Jacek Wielemborek
2016-01-05 15:24 ` Jeff King
2016-01-06  0:23   ` Jonathan Nieder
2016-01-06  7:23     ` Jeff King
2016-01-06  9:27     ` Jacek Wielemborek
2016-01-06  9:46   ` Duy Nguyen
2016-01-06 12:51     ` Jacek Wielemborek
2016-01-07 19:37   ` Junio C Hamano
2016-01-07 22:54     ` Junio C Hamano
2016-01-11 21:33       ` Jeff King
2016-02-24 11:05       ` Jeff King
2016-02-24 18:48         ` Junio C Hamano [this message]
2016-02-25 14:12           ` 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=xmqqegc2t05g.fsf@gitster.mtv.corp.google.com \
    --to=gitster@pobox$(echo .)com \
    --cc=d33tah@gmail$(echo .)com \
    --cc=git@vger$(echo .)kernel.org \
    --cc=peff@peff$(echo .)net \
    /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