summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b8469ad)
raw | patch | inline | side by side (parent: b8469ad)
author | Jeff King <peff@peff.net> | |
Thu, 29 Jan 2009 05:56:34 +0000 (00:56 -0500) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Thu, 29 Jan 2009 07:40:53 +0000 (23:40 -0800) |
The size of the content we are adding may be larger than
2.1G (i.e., "git add gigantic-file"). Most of the code-path
to do so uses size_t or unsigned long to record the size,
but write_loose_object uses a signed int.
On platforms where "int" is 32-bits (which includes x86_64
Linux platforms), we end up passing malloc a negative size.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2.1G (i.e., "git add gigantic-file"). Most of the code-path
to do so uses size_t or unsigned long to record the size,
but write_loose_object uses a signed int.
On platforms where "int" is 32-bits (which includes x86_64
Linux platforms), we end up passing malloc a negative size.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
sha1_file.c | patch | blob | history |
diff --git a/sha1_file.c b/sha1_file.c
index 88035a0cd19d040c8b626684c3ff1f7fdb35e837..0cfea9edc15402a38bbd195104c54e103b05f5a9 100644 (file)
--- a/sha1_file.c
+++ b/sha1_file.c
static int write_loose_object(const unsigned char *sha1, char *hdr, int hdrlen,
void *buf, unsigned long len, time_t mtime)
{
- int fd, size, ret;
+ int fd, ret;
+ size_t size;
unsigned char *compressed;
z_stream stream;
char *filename;