All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Habouzit <madcoder@debian.org>
To: git@vger.kernel.org
Cc: Pierre Habouzit <madcoder@debian.org>
Subject: [PATCH] Fix a comparison bug in diff-delta.c
Date: Wed, 23 Aug 2006 11:17:55 +0200	[thread overview]
Message-ID: <1156324675415-git-send-email-madcoder@debian.org> (raw)

  (1 << i) < hspace is compared in the `int` space rather that in the
  unsigned one.  the result will be wrong if hspace is between 0x40000000
  and 0x80000000.

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
---

  This is a replacement for <1156300368160-git-send-email-madcoder@debian.org>
  avoiding the ugly cast, and using 1u instead.

 diff-delta.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/diff-delta.c b/diff-delta.c
index 7da9205..51e2e56 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -152,7 +152,7 @@ struct delta_index * create_delta_index(
 	   initialization in create_delta(). */
 	entries = (bufsize - 1)  / RABIN_WINDOW;
 	hsize = entries / 4;
-	for (i = 4; (1 << i) < hsize && i < 31; i++);
+	for (i = 4; (1u << i) < hsize && i < 31; i++);
 	hsize = 1 << i;
 	hmask = hsize - 1;
 
-- 
1.4.1.1

             reply	other threads:[~2006-08-23  9:18 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-23  9:17 Pierre Habouzit [this message]
2006-08-23 13:45 ` [PATCH] Fix a comparison bug in diff-delta.c Johannes Schindelin
2006-08-23 14:31   ` Pierre Habouzit
  -- strict thread matches above, loose matches on Subject: below --
2006-08-23  2:32 Pierre Habouzit
2006-08-23  2:38 ` Pierre Habouzit
2006-08-23  3:17 ` Nicolas Pitre

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=1156324675415-git-send-email-madcoder@debian.org \
    --to=madcoder@debian.org \
    --cc=git@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.