Re: git for-each-ref crashes for %(body) with tags

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



"Han-Wen Nienhuys" <hanwenn@xxxxxxxxx> writes:

> see gdb trace below.   Unfortunately, I don't have a repo that I can
> readily share to demonstrate this.

You have a tag that has a single incomplete line as its payload.  The
attached patch should fix it, but I wonder how you created such an unusual
(I would not say "broken") tag to begin with?


diff --git i/builtin-for-each-ref.c w/builtin-for-each-ref.c
index 445039e..4d25ec5 100644
--- i/builtin-for-each-ref.c
+++ w/builtin-for-each-ref.c
@@ -459,8 +459,10 @@ static void find_subpos(const char *buf, unsigned long sz, const char **sub, con
 		return;
 	*sub = buf; /* first non-empty line */
 	buf = strchr(buf, '\n');
-	if (!buf)
+	if (!buf) {
+		*body = "";
 		return; /* no body */
+	}
 	while (*buf == '\n')
 		buf++; /* skip blank between subject and body */
 	*body = buf;
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux