From 4d4befac3365dc2161a8164ea4c07c4ef48942ef Mon Sep 17 00:00:00 2001 From: Edward Thomson Date: Wed, 5 Aug 2020 10:07:23 +0100 Subject: [PATCH] pack: check pack_window_open return --- src/pack.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pack.c b/src/pack.c index d9e8bf2d5..71d321ae4 100644 --- a/src/pack.c +++ b/src/pack.c @@ -844,7 +844,10 @@ static int packfile_unpack_compressed( unsigned int window_len; unsigned char *in; - in = pack_window_open(p, mwindow, *position, &window_len); + if ((in = pack_window_open(p, mwindow, *position, &window_len)) == NULL) { + error = -1; + goto out; + } if ((error = git_zstream_set_input(&zstream, in, window_len)) < 0 || (error = git_zstream_get_output_chunk(data + total, &bytes, &zstream)) < 0) {