From: Martin Koegler <mkoegler@auto.tuwien.ac.at>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Martin Koegler <mkoegler@auto.tuwien.ac.at>
Subject: [PATCH] parse_tag: fail, if tagged objected would be NULL
Date: Sat, 16 Feb 2008 14:04:40 +0100 [thread overview]
Message-ID: <12031670802582-git-send-email-mkoegler@auto.tuwien.ac.at> (raw)
The cause of a NULL in tag->tagged can be:
* a unknown object type is used
* the tag points to a object with an other type as stated
in the tag.
Both situations are most likley be caused by a not welformed
tag. Catching this error here avoids doing tag->tagged!=NULL
checks in the rest of git.
Signed-off-by: Martin Koegler <mkoegler@auto.tuwien.ac.at>
---
In my option, this change would simplity many things.
tag.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/tag.c b/tag.c
index 38bf913..96fef70 100644
--- a/tag.c
+++ b/tag.c
@@ -82,8 +82,12 @@ int parse_tag_buffer(struct tag *item, void *data, unsigned long size)
} else {
error("Unknown type %s", type);
item->tagged = NULL;
+ return -1;
}
+ if (!item->tagged)
+ return -1;
+
if (item->tagged && track_object_refs) {
struct object_refs *refs = alloc_object_refs(1);
refs->ref[0] = item->tagged;
--
1.5.4.1.gcb4c5
next reply other threads:[~2008-02-16 13:05 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-16 13:04 Martin Koegler [this message]
2008-02-16 19:13 ` [PATCH] parse_tag: fail, if tagged objected would be NULL Junio C Hamano
2008-02-17 17:48 ` Martin Koegler
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=12031670802582-git-send-email-mkoegler@auto.tuwien.ac.at \
--to=mkoegler@auto.tuwien.ac.at \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).