diff options
author | Junio C Hamano <gitster@pobox.com> | 2017-10-18 08:19:14 +0300 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2017-10-18 08:19:14 +0300 |
commit | eeed979e6a13b60667c856dc3418a14f67607875 (patch) | |
tree | 9802c59da024ca04ba0dfe1f41a47a70226b8351 /sha1_file.c | |
parent | a116022e03d3ef6b402658a4f41a4840c8463f36 (diff) | |
parent | b3ea7dd32d6f8dc117b782ec5ca54ef8f65280c9 (diff) |
Merge branch 'jk/sha1-loose-object-info-fix' into maint
Leakfix and futureproofing.
* jk/sha1-loose-object-info-fix:
sha1_loose_object_info: handle errors from unpack_sha1_rest
Diffstat (limited to 'sha1_file.c')
-rw-r--r-- | sha1_file.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sha1_file.c b/sha1_file.c index 9008d6aa7b..5911364a81 100644 --- a/sha1_file.c +++ b/sha1_file.c @@ -2952,10 +2952,14 @@ static int sha1_loose_object_info(const unsigned char *sha1, } else if ((status = parse_sha1_header_extended(hdr, oi, flags)) < 0) status = error("unable to parse %s header", sha1_to_hex(sha1)); - if (status >= 0 && oi->contentp) + if (status >= 0 && oi->contentp) { *oi->contentp = unpack_sha1_rest(&stream, hdr, *oi->sizep, sha1); - else + if (!*oi->contentp) { + git_inflate_end(&stream); + status = -1; + } + } else git_inflate_end(&stream); munmap(map, mapsize); |