summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2007-10-29 12:53:54 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2007-10-29 12:53:54 -0700
commite2b7eaf0ca3897940961d23392d4ff718867ea9f (patch)
treebf24e41872b28f8dc50db5f24e0222117da71da6 /sha1_file.c
parentRemove outdated references to cogito in documentation (diff)
parentRelNotes-1.5.3.5: describe recent fixes (diff)
downloadtgif-e2b7eaf0ca3897940961d23392d4ff718867ea9f.tar.xz
Merge branch 'maint'
* maint: RelNotes-1.5.3.5: describe recent fixes merge-recursive.c: mrtree in merge() is not used before set sha1_file.c: avoid gcc signed overflow warnings Fix a small memory leak in builtin-add honor the http.sslVerify option in shell scripts
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 83a06a7aed..f007874cbb 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -521,13 +521,15 @@ static int check_packed_git_idx(const char *path, struct packed_git *p)
munmap(idx_map, idx_size);
return error("wrong index v2 file size in %s", path);
}
- if (idx_size != min_size) {
- /* make sure we can deal with large pack offsets */
- off_t x = 0x7fffffffUL, y = 0xffffffffUL;
- if (x > (x + 1) || y > (y + 1)) {
- munmap(idx_map, idx_size);
- return error("pack too large for current definition of off_t in %s", path);
- }
+ if (idx_size != min_size &&
+ /*
+ * make sure we can deal with large pack offsets.
+ * 31-bit signed offset won't be enough, neither
+ * 32-bit unsigned one will be.
+ */
+ (sizeof(off_t) <= 4)) {
+ munmap(idx_map, idx_size);
+ return error("pack too large for current definition of off_t in %s", path);
}
}