Andrew's git
/
gitweb.git
/ diff
summary
|
log
|
commit
| diff |
tree
commit
grep
author
committer
pickaxe
?
re
Merge branch 'jk/sha1-loose-object-info-fix'
author
Junio C Hamano
<gitster@pobox.com>
Wed, 11 Oct 2017 05:52:22 +0000
(14:52 +0900)
committer
Junio C Hamano
<gitster@pobox.com>
Wed, 11 Oct 2017 05:52:22 +0000
(14:52 +0900)
Leakfix and futureproofing.
* jk/sha1-loose-object-info-fix:
sha1_loose_object_info: handle errors from unpack_sha1_rest
sha1_file.c
patch
|
blob
|
history
raw
(from parent 1:
4af0500
)
diff --git
a/sha1_file.c
b/sha1_file.c
index 09ad64ce555e0b908ce0d9f22219026a2d37ae0c..10c3a0083dedee98dc3d48267ad349589adef3f0 100644
(file)
--- a/
sha1_file.c
+++ b/
sha1_file.c
@@
-1124,10
+1124,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);