summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-10-29 19:53:54 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-10-29 19:53:54 (GMT)
commite2b7eaf0ca3897940961d23392d4ff718867ea9f (patch)
treebf24e41872b28f8dc50db5f24e0222117da71da6 /sha1_file.c
parent8371d8fd094548c1d02b8583fdbff8204a725ffc (diff)
parente720c4382f6c9317a3b495e80c7dfc609a0db5e6 (diff)
downloadgit-e2b7eaf0ca3897940961d23392d4ff718867ea9f.zip
git-e2b7eaf0ca3897940961d23392d4ff718867ea9f.tar.gz
git-e2b7eaf0ca3897940961d23392d4ff718867ea9f.tar.bz2
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 83a06a7..f007874 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);
}
}