Skip to content

Commit cac05d4

Browse files
peffgitster
authored andcommitted
count-objects: do not use xsize_t when counting object size
The point of xsize_t is to safely cast an off_t into a size_t (because we are about to mmap). But in count-objects, we are summing the sizes in an off_t. Using xsize_t means that count-objects could fail on a 32-bit system with a 4G object (not likely, as other parts of git would fail, but we should at least be correct here). Signed-off-by: Jeff King <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 0d3b729 commit cac05d4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

builtin/count-objects.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
5353
if (lstat(path, &st) || !S_ISREG(st.st_mode))
5454
bad = 1;
5555
else
56-
(*loose_size) += xsize_t(on_disk_bytes(st));
56+
(*loose_size) += on_disk_bytes(st);
5757
}
5858
if (bad) {
5959
if (verbose) {

0 commit comments

Comments
 (0)