mirror of
https://github.com/git/git.git
synced 2024-11-24 10:26:17 +08:00
avoid 31-bit truncation in write_loose_object
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>
This commit is contained in:
parent
b8469ad057
commit
915308b187
@ -2280,7 +2280,8 @@ static int create_tmpfile(char *buffer, size_t bufsiz, const char *filename)
|
||||
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;
|
||||
|
Loading…
Reference in New Issue
Block a user