Skip to content

Commit

Permalink
Fix a comparison bug in diff-delta.c
Browse files Browse the repository at this point in the history
(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>
Signed-off-by: Junio C Hamano <junkio@cox.net>
  • Loading branch information
Pierre Habouzit authored and Junio C Hamano committed Aug 23, 2006
1 parent 68d42c4 commit b05faa2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion diff-delta.c
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
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;

Expand Down

0 comments on commit b05faa2

Please sign in to comment.