summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc49cd7)
raw | patch | inline | side by side (parent: dc49cd7)
author | Thomas Rast <trast@student.ethz.ch> | |
Wed, 28 Jul 2010 16:36:31 +0000 (18:36 +0200) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Wed, 28 Jul 2010 21:08:44 +0000 (14:08 -0700) |
Attempting to mmap (via git-add or similar) a file larger than 4GB on
32-bit Linux systems results in a repository that has only the file
modulo 4GB stored, because of truncation of the off_t file size to a
size_t for mmap.
When xsize_t was introduced to handle this truncation in dc49cd7 (Cast
64 bit off_t to 32 bit size_t, 2007-03-06), Shawn even pointed out
that it should detect when such a cutoff happens.
Make it so.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
32-bit Linux systems results in a repository that has only the file
modulo 4GB stored, because of truncation of the off_t file size to a
size_t for mmap.
When xsize_t was introduced to handle this truncation in dc49cd7 (Cast
64 bit off_t to 32 bit size_t, 2007-03-06), Shawn even pointed out
that it should detect when such a cutoff happens.
Make it so.
Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-compat-util.h | patch | blob | history |
diff --git a/git-compat-util.h b/git-compat-util.h
index 7534db1267bfa64a4a0cba80680fefc42177f0e8..513d2d7aee1bc56e23ac3f5829c3ff531f37ae5b 100644 (file)
--- a/git-compat-util.h
+++ b/git-compat-util.h
static inline size_t xsize_t(off_t len)
{
+ if (len > (size_t) len)
+ die("Cannot handle files this big");
return (size_t)len;
}