Skip to content

Commit 30beb16

Browse files
author
Philip Oakley
committed
index-pack.c: limit zlib stream buffer capacity
Signed-off-by: Philip Oakley <[email protected]>
1 parent 263b8e9 commit 30beb16

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

builtin/index-pack.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -441,12 +441,12 @@ static void *unpack_entry_data(off_t offset, size_t size,
441441
if (type == OBJ_BLOB && size > big_file_threshold)
442442
buf = fixed_buf;
443443
else
444-
buf = xmallocz(size);
444+
buf = xmallocz(zlib_buf_cap(size));
445445

446446
memset(&stream, 0, sizeof(stream));
447447
git_inflate_init(&stream);
448448
stream.next_out = buf;
449-
stream.avail_out = buf == fixed_buf ? sizeof(fixed_buf) : size;
449+
stream.avail_out = buf == fixed_buf ? sizeof(fixed_buf) : zlib_buf_cap(size);
450450

451451
do {
452452
unsigned char *last_out = stream.next_out;

0 commit comments

Comments
 (0)