summaryrefslogtreecommitdiff
path: root/sha1_name.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2008-02-18 20:56:01 -0800
committerJunio C Hamano <gitster@pobox.com>2008-02-18 20:56:01 -0800
commitee4f06c0a60d8b17efdd8f6a3332f175f6aafe0e (patch)
treeb73e7c94f1cadff7cdaae5e4ddc27e7dda1c2f02 /sha1_name.c
parent3d51e1b5b84bde24f9a19e3cee603f0b57f62001 (diff)
parentf73df331a43a6092af427fd30bb6ce07f313743c (diff)
downloadgit-ee4f06c0a60d8b17efdd8f6a3332f175f6aafe0e.tar.gz
Merge branch 'mk/maint-parse-careful'
* mk/maint-parse-careful: peel_onion: handle NULL check return value from parse_commit() in various functions parse_commit: don't fail, if object is NULL revision.c: handle tag->tagged == NULL reachable.c::process_tree/blob: check for NULL process_tag: handle tag->tagged == NULL check results of parse_commit in merge_bases list-objects.c::process_tree/blob: check for NULL reachable.c::add_one_tree: handle NULL from lookup_tree mark_blob/tree_uninteresting: check for NULL get_sha1_oneline: check return value of parse_object read_object_with_reference: don't read beyond the buffer
Diffstat (limited to 'sha1_name.c')
-rw-r--r--sha1_name.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/sha1_name.c b/sha1_name.c
index ed3c867d6a..c2805e736b 100644
--- a/sha1_name.c
+++ b/sha1_name.c
@@ -494,8 +494,11 @@ static int peel_onion(const char *name, int len, unsigned char *sha1)
return error("%.*s: expected %s type, but the object dereferences to %s type",
len, name, typename(expected_type),
typename(o->type));
+ if (!o)
+ return -1;
if (!o->parsed)
- parse_object(o->sha1);
+ if (!parse_object(o->sha1))
+ return -1;
}
}
return 0;
@@ -620,7 +623,8 @@ static int get_sha1_oneline(const char *prefix, unsigned char *sha1)
unsigned long size;
commit = pop_most_recent_commit(&list, ONELINE_SEEN);
- parse_object(commit->object.sha1);
+ if (!parse_object(commit->object.sha1))
+ continue;
if (temp_commit_buffer)
free(temp_commit_buffer);
if (commit->buffer)