From: Elijah Newren <newren@gmail.com>
To: Taylor Blau <me@ttaylorr.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
Junio C Hamano <gitster@pobox.com>,
Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH v2 0/2] pseudo-merge: various small fixes
Date: Fri, 14 Jun 2024 21:08:53 +0000 [thread overview]
Message-ID: <CABPp-BF71VWMmSHNx7-dbs8ek+dK0kPTUnSv2OJmM9VYq-LOkQ@mail.gmail.com> (raw)
In-Reply-To: <cover.1718392943.git.me@ttaylorr.com>
On Fri, Jun 14, 2024 at 7:23 PM Taylor Blau <me@ttaylorr.com> wrote:
>
> Here is a small reroll of a couple of patches I wrote to fix various
> small issues with the tb/pseudo-merge-reachability-bitmaps topic.
>
> The only change since last time is replacing:
>
> if (st_mult(index->pseudo_merges.nr, sizeof(uint64_t)) > table_size - 24)
>
> with:
>
> if (st_add(st_mult(index->pseudo_merges.nr, sizeof(uint64_t)), 24) > table_size)
>
> based on helpful review from Junio. For convenience, a range-diff is
> below. Thanks in advance for any final review on this topic :-).
>
> Taylor Blau (2):
> Documentation/technical/bitmap-format.txt: add missing position table
> pack-bitmap.c: ensure pseudo-merge offset reads are bounded
>
> Documentation/technical/bitmap-format.txt | 9 +++++++++
> pack-bitmap.c | 5 +++++
> 2 files changed, 14 insertions(+)
>
> Range-diff against v1:
> -: ---------- > 1: a71ec05e5d Documentation/technical/bitmap-format.txt: add missing position table
> 1: 0a16399d14 ! 2: 8abd564e7c pack-bitmap.c: ensure pseudo-merge offset reads are bounded
> @@ Commit message
> end of the mmap'd region.
>
> Prevent this by ensuring that we have at least `table_size - 24` many
> - bytes available to read (subtracting 24 as the length of the metadata
> - component).
> + bytes available to read (adding 24 to the left-hand side of our
> + inequality to account for the length of the metadata component).
>
> This is sufficient to prevent us from reading off the end of the
> pseudo-merge extension, and ensures that all of the get_be64() calls
> @@ pack-bitmap.c: static int load_bitmap_header(struct bitmap_index *index)
> index->pseudo_merges.commits_nr = get_be32(index_end - 20);
> index->pseudo_merges.nr = get_be32(index_end - 24);
>
> -+ if (st_mult(index->pseudo_merges.nr, sizeof(uint64_t)) > table_size - 24)
> ++ if (st_add(st_mult(index->pseudo_merges.nr,
> ++ sizeof(uint64_t)),
> ++ 24) > table_size)
> + return error(_("corrupted bitmap index file, pseudo-merge table too short"));
> +
> CALLOC_ARRAY(index->pseudo_merges.v,
>
> base-commit: 0b7500dc66ffcb6b1ccc3332715936a59c6b5ce4
> --
> 2.45.0.33.g0a16399d14.dirty
Series looks good to me.
next prev parent reply other threads:[~2024-06-14 21:09 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-06 18:40 [PATCH 1/2] Documentation/technical/bitmap-format.txt: add missing position table Taylor Blau
2024-06-06 18:41 ` [PATCH 2/2] pack-bitmap.c: ensure pseudo-merge offset reads are bounded Taylor Blau
2024-06-06 19:42 ` Junio C Hamano
2024-06-06 22:25 ` Taylor Blau
2024-06-06 22:35 ` Junio C Hamano
2024-06-06 22:38 ` Taylor Blau
2024-06-14 18:23 ` Junio C Hamano
2024-06-14 19:23 ` [PATCH v2 0/2] pseudo-merge: various small fixes Taylor Blau
2024-06-14 19:23 ` [PATCH v2 1/2] Documentation/technical/bitmap-format.txt: add missing position table Taylor Blau
2024-06-14 19:23 ` [PATCH v2 2/2] pack-bitmap.c: ensure pseudo-merge offset reads are bounded Taylor Blau
2024-06-14 21:08 ` Elijah Newren [this message]
2024-06-14 21:23 ` [PATCH v2 0/2] pseudo-merge: various small fixes 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=CABPp-BF71VWMmSHNx7-dbs8ek+dK0kPTUnSv2OJmM9VYq-LOkQ@mail.gmail.com \
--to=newren@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=me@ttaylorr.com \
--cc=peff@peff.net \
--cc=ps@pks.im \
/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).