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

[PATCH] verify_pack: do not ignore return value of verification function

From
David Turner <dturner@twopensource.com>
Date
Nov 30, 2015, 22:47 UTC
Message-ID
<1448923662-24725-1-git-send-email-dturner@twopensource.com>

In verify_pack, a caller-supplied verification function is called. The function returns an int. If that return value is non-zero, verify_pack should fail.

The only caller of verify_pack is in builtin/fsck.c, whose verify_fn returns a meaningful error code (which was then ignored). Now, fsck might return a different error code (with more detail). This would happen in the unlikely event that a commit or tree that is a valid git object but not a valid instance of its type gets into a pack.

Signed-off-by: David Turner <dturner@twopensource.com>
---
 pack-check.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/pack-check.c b/pack-check.c
index 63a595c..433bd86 100644
--- a/pack-check.c
+++ b/pack-check.c
@@ -126,7 +126,7 @@ static int verify_packfile(struct packed_git *p,
 				    sha1_to_hex(entries[i].sha1), p->pack_name);
 		else if (fn) {
 			int eaten = 0;
-			fn(entries[i].sha1, type, size, data, &eaten);
+			err |= fn(entries[i].sha1, type, size, data, &eaten);
 			if (eaten)
 				data = NULL;
 		}
-- 
2.4.2.736.g391bb05-twtrsrc
Next: Jeff King
Message 1 of 2 in “verify_pack: do not ignore return value of verification function”
  1. verify_pack: do not ignore return value of verification functionDavid Turner, Nov 30, 2015
  2. Jeff KingDec 1, 2015

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.