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 <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jeff King committed
Oct 15, 2014 at 18:40 UTC
cac05d4dfd148071462939a61ecd44cf932a0b02
1 file changed
+1
-1
builtin/count-objects.c
+1
-1
@@ -53,7 +53,7 @@ static void count_objects(DIR *d, char *path, int len, int verbose,
53
if (lstat(path, &st) || !S_ISREG(st.st_mode))
54
bad = 1;
55
else
56
- (*loose_size) += xsize_t(on_disk_bytes(st));
56
+ (*loose_size) += on_disk_bytes(st);
57
}
58
if (bad) {
59
if (verbose) {