xsize_t: check whether we lose bits
[gitweb.git] / git-compat-util.h
index 7534db1267bfa64a4a0cba80680fefc42177f0e8..513d2d7aee1bc56e23ac3f5829c3ff531f37ae5b 100644 (file)
@@ -260,6 +260,8 @@ static inline ssize_t xwrite(int fd, const void *buf, size_t len)
 
 static inline size_t xsize_t(off_t len)
 {
+       if (len > (size_t) len)
+               die("Cannot handle files this big");
        return (size_t)len;
 }