From 9534f40bc42dd826cc26c8c8c84f6a8a5fc569f6 Mon Sep 17 00:00:00 2001 From: Junio C Hamano Date: Wed, 2 Nov 2005 15:19:13 -0800 Subject: Be careful when dereferencing tags. One caller of deref_tag() was not careful enough to make sure what deref_tag() returned was not NULL (i.e. we found a tag object that points at an object we do not have). Fix it, and warn about refs that point at such an incomplete tag where needed. Signed-off-by: Junio C Hamano --- tag.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'tag.c') diff --git a/tag.c b/tag.c index b1ab75ff0..e574c4b7a 100644 --- a/tag.c +++ b/tag.c @@ -3,10 +3,15 @@ const char *tag_type = "tag"; -struct object *deref_tag(struct object *o) +struct object *deref_tag(struct object *o, const char *warn, int warnlen) { while (o && o->type == tag_type) o = parse_object(((struct tag *)o)->tagged->sha1); + if (!o && warn) { + if (!warnlen) + warnlen = strlen(warn); + error("missing object referenced by '%.*s'", warnlen, warn); + } return o; } -- cgit v1.2.1