diff options
author | Junio C Hamano <gitster@pobox.com> | 2008-02-18 20:56:01 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2008-02-18 20:56:01 -0800 |
commit | ee4f06c0a60d8b17efdd8f6a3332f175f6aafe0e (patch) | |
tree | b73e7c94f1cadff7cdaae5e4ddc27e7dda1c2f02 /reachable.c | |
parent | 3d51e1b5b84bde24f9a19e3cee603f0b57f62001 (diff) | |
parent | f73df331a43a6092af427fd30bb6ce07f313743c (diff) | |
download | git-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 'reachable.c')
-rw-r--r-- | reachable.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/reachable.c b/reachable.c index 823e3242ec..3b1c18ff9b 100644 --- a/reachable.c +++ b/reachable.c @@ -15,6 +15,8 @@ static void process_blob(struct blob *blob, { struct object *obj = &blob->object; + if (!blob) + die("bad blob object"); if (obj->flags & SEEN) return; obj->flags |= SEEN; @@ -39,6 +41,8 @@ static void process_tree(struct tree *tree, struct name_entry entry; struct name_path me; + if (!tree) + die("bad tree object"); if (obj->flags & SEEN) return; obj->flags |= SEEN; @@ -79,7 +83,8 @@ static void process_tag(struct tag *tag, struct object_array *p, const char *nam if (parse_tag(tag) < 0) die("bad tag object %s", sha1_to_hex(obj->sha1)); - add_object(tag->tagged, p, NULL, name); + if (tag->tagged) + add_object(tag->tagged, p, NULL, name); } static void walk_commit_list(struct rev_info *revs) @@ -150,7 +155,8 @@ static int add_one_reflog(const char *path, const unsigned char *sha1, int flag, static void add_one_tree(const unsigned char *sha1, struct rev_info *revs) { struct tree *tree = lookup_tree(sha1); - add_pending_object(revs, &tree->object, ""); + if (tree) + add_pending_object(revs, &tree->object, ""); } static void add_cache_tree(struct cache_tree *it, struct rev_info *revs) |