List for cgit developers and users
 help / color / mirror / Atom feed
From: john at keeping.me.uk (John Keeping)
Subject: [PATCH 1/1] ui-log: fix data corruption
Date: Sun, 16 Oct 2016 12:54:23 +0100	[thread overview]
Message-ID: <20161016115423.GF22407@john.keeping.me.uk> (raw)
In-Reply-To: <CAHmME9ogcpFmL0pSjg=g2bUVG-1Zrw=DZHp6_LoVSc8mGNLi_w@mail.gmail.com>

On Wed, Oct 12, 2016 at 01:23:45PM +0200, Jason A. Donenfeld wrote:
> So what's the verdict here? Do we have a double free or not?

The current code is fine, providing we don't re-order it.

The issue is that we free commit blobs while walking the log, so any
attempt to use them after that without reloading the data goes through a
null pointer.

We should possibly change cgit_parse_commit() to use get_commit_buffer()
rather than get_cached_commit_buffer(), which improves the usability of
that function but hides potential inefficiency if we free the buffer and
end up reloading it.

The use of get_cached_commit_buffer() dates from an update in git.git
which moved the buffer pointer out of struct commit, previously we just
accessed commit->buffer here and relied on the buffer having been loaded
previously.


      reply	other threads:[~2016-10-16 11:54 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-07 13:35 list
2016-10-07 19:43 ` Jason
2016-10-07 21:21   ` list
2016-10-07 21:25     ` list
2016-10-09 11:26     ` john
2016-10-10 14:00       ` list
2016-10-12 11:23         ` Jason
2016-10-16 11:54           ` john [this message]

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=20161016115423.GF22407@john.keeping.me.uk \
    --to=cgit@lists.zx2c4.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).