Skip to content

Commit b05faa2

Browse files
MadCoderJunio C Hamano
authored andcommitted
Fix a comparison bug in diff-delta.c
(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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 68d42c4 commit b05faa2

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

diff-delta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
152152
initialization in create_delta(). */
153153
entries = (bufsize - 1) / RABIN_WINDOW;
154154
hsize = entries / 4;
155-
for (i = 4; (1 << i) < hsize && i < 31; i++);
155+
for (i = 4; (1u << i) < hsize && i < 31; i++);
156156
hsize = 1 << i;
157157
hmask = hsize - 1;
158158

0 commit comments

Comments
 (0)