From: Junio C Hamano <gitster@pobox.com>
To: Jeff King <peff@peff.net>
Cc: Taylor Blau <me@ttaylorr.com>, git@vger.kernel.org, stolee@gmail.com
Subject: Re: [PATCH 3/3] commit-graph.c: handle corrupt/missing trees
Date: Fri, 06 Sep 2019 10:11:09 -0700 [thread overview]
Message-ID: <xmqq5zm5nydu.fsf@gitster-ct.c.googlers.com> (raw)
In-Reply-To: <xmqqo8zxnz0m.fsf@gitster-ct.c.googlers.com> (Junio C. Hamano's message of "Fri, 06 Sep 2019 09:57:29 -0700")
Junio C Hamano <gitster@pobox.com> writes:
> ...
> Is there even a single caller that is prepared to react to NULL?
>
> Answer. There is a single hit inside fsck.c that wants to report
> an error without killing ourselves in fsck_commit_buffer(). I
> however doubt its use of get_commit_tree() is correct in the
> first place. The function is about validating the commit object
> payload manually, without trusting the result of parse_commit(),
> and it does read the object name of the tree object; the call to
> get_commit_tree() used for reporting the error there should
> probably become has_object() on the tree_oid.
At least we need to ensure, not just has_object(), but the object
indeed claims to be a tree object. It is OK if it is a corrupt
tree object---we'll catch its brokenness separately anyway.
Hmm, the should we also tolerate the pointed object to be broken
in a way that it is not even able to claim to be a tree object?
That would mean that has_object() is sufficient to check here.
OK, so...
> So, after fixing the above, we may safely be able to die inside
> get_commit_tree() instead of returning NULL.
>
> By the way, I think get_commit_tree() and parse_commit() in fsck
> should always use the value obtained from the underlying object and
> bypass any caches like commit graph---if they pay attention to the
> caches, they should be fixed. Secondary caches like commit graph
> should of course be validated against what are recorded in the
> underlying object, but that should be done separately.
next prev parent reply other threads:[~2019-09-06 17:11 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-05 22:04 [PATCH 0/3] commit-graph: harden against various corruptions Taylor Blau
2019-09-05 22:04 ` [PATCH 1/3] t/t5318: introduce failing 'git commit-graph write' tests Taylor Blau
2019-09-06 16:48 ` Derrick Stolee
2019-09-05 22:04 ` [PATCH 2/3] commit-graph.c: handle commit parsing errors Taylor Blau
2019-09-05 22:04 ` [PATCH 3/3] commit-graph.c: handle corrupt/missing trees Taylor Blau
2019-09-06 6:19 ` Jeff King
2019-09-06 15:42 ` Taylor Blau
2019-09-06 17:34 ` Jeff King
2019-09-06 16:51 ` Derrick Stolee
2019-09-06 17:37 ` Jeff King
2019-09-06 16:57 ` Junio C Hamano
2019-09-06 17:11 ` Junio C Hamano [this message]
2019-09-06 17:30 ` Jeff King
2019-09-06 17:28 ` Jeff King
2019-09-09 17:55 ` 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
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=xmqq5zm5nydu.fsf@gitster-ct.c.googlers.com \
--to=gitster@pobox.com \
--cc=git@vger.kernel.org \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=stolee@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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
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).