git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Taylor Blau <me@ttaylorr.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Jeff King <peff@peff.net>,
	Elijah Newren <newren@gmail.com>, Patrick Steinhardt <ps@pks.im>
Subject: Re: [PATCH 2/2] pack-bitmap.c: ensure pseudo-merge offset reads are bounded
Date: Thu, 6 Jun 2024 18:38:02 -0400	[thread overview]
Message-ID: <ZmI6SqIFkWz8OPr1@nand.local> (raw)
In-Reply-To: <xmqqjzj1k8c8.fsf@gitster.g>

On Thu, Jun 06, 2024 at 03:35:51PM -0700, Junio C Hamano wrote:
> Taylor Blau <me@ttaylorr.com> writes:
>
> > On Thu, Jun 06, 2024 at 12:42:59PM -0700, Junio C Hamano wrote:
> >> Can table_size at this point be smaller than 24, which will allow
> >> (table_size - 24) to be a huge number that st_mult() will
> >> comfortably fit?
> >
> > It could be smaller than 24, but I think we're at the point of
> > diminishing returns here.
>
> I only meant to say that we could easily rewrite
>
> 	if (st_mult() > table_size - 24)
>
> condition to
>
> 	if (st_add(st_mult(), 24) > table_size)
>
> and we do not have to think if we have already checked table_size
> before we reach this point of the control flow.

Ah. Thanks for the clarification. Yes, I think you could do so; I'm
happy to send another version if you like.

Thanks,
Taylor

  reply	other threads:[~2024-06-06 22:38 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 [this message]
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   ` [PATCH v2 0/2] pseudo-merge: various small fixes Elijah Newren
2024-06-14 21:23     ` 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=ZmI6SqIFkWz8OPr1@nand.local \
    --to=me@ttaylorr.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=newren@gmail.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).