git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH] Fix git-fsck-cache segfault on invalid tag

From
FSFrank Sorenson <frank@tuxrocks.com>
Date
May 20, 2005, 07:00 UTC
Message-ID
<428D8B19.4070605@tuxrocks.com>
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

git-fsck-cache will segfault if a tag contains a non-existent sha1. This patch fixes fsck-cache to report the invalid tag and not die.

- ---
commit a6a237ee3f3d2f5d76499b8f32f58057c9b4cd2d
tree ac5d65a040c22194ddcd0706dc5f0b8bb52aef65
parent 5cd4c7b7686d334e341b21d92449349feda3ef65
author Frank Sorenson <frank@tuxrocks.com> Fri, 20 May 2005 00:52:59 -0600
committer Frank Sorenson <frank@tuxrocks.com> Fri, 20 May 2005 00:52:59 -0600
 fsck-cache.c |    4 ++++
 1 files changed, 4 insertions(+)
Index: fsck-cache.c
===================================================================
- --- ca5fef50fb68a3afbb35e1a48ac622f7a964f021/fsck-cache.c  (mode:100644)
+++ ac5d65a040c22194ddcd0706dc5f0b8bb52aef65/fsck-cache.c  (mode:100644)
@@ -315,6 +315,10 @@
 		return;
 
 	obj = lookup_object(sha1);
+	if (!obj) {
+		fprintf(stderr, "invalid tag %s - %s\n", path, hexname);
+		return;
+	}
 	obj->used = 1;
 	mark_reachable(obj, REACHABLE);
 }

Frank
- -- 
Frank Sorenson - KD7TZK
Systems Manager, Computer Science Department
Brigham Young University
frank@tuxrocks.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.6 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCjYsZaI0dwg4A47wRAn2PAJ9hyoev3stnaN0Qn2wWlBJEKiucQACgvT9Z
rVazYmUFj3nXvJDYaBoSRsM=
=KbSv
-----END PGP SIGNATURE-----
Next: Petr Baudis
Message 1 of 4 in “Fix git-fsck-cache segfault on invalid tag”
  1. Fix git-fsck-cache segfault on invalid tagFrank Sorenson, May 20, 2005
  2. Petr BaudisMay 20, 2005
  3. Junio C HamanoMay 20, 2005
  4. Frank SorensonMay 20, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.