Thread (16 messages) 16 messages, 2 authors, 2025-05-15
STALE409d

[PATCH 03/14] fetch-pack: defensive programming

From: Johannes Schindelin via GitGitGadget <hidden>
Date: 2025-05-15 12:45:46
Subsystem: the rest · Maintainer: Linus Torvalds

From: Johannes Schindelin <redacted>

CodeQL points out that `parse_object()` can return NULL values.

Signed-off-by: Johannes Schindelin <redacted>
---
 fetch-pack.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fetch-pack.c b/fetch-pack.c
index 1ed5e11dd568..4cbcb0c14c48 100644
--- a/fetch-pack.c
+++ b/fetch-pack.c
@@ -155,7 +155,7 @@ static struct commit *deref_without_lazy_fetch(const struct object_id *oid,
 			struct tag *tag = (struct tag *)
 				parse_object(the_repository, oid);
 
-			if (!tag->tagged)
+			if (!tag || !tag->tagged)
 				return NULL;
 			if (mark_tags_complete_and_check_obj_db)
 				tag->object.flags |= COMPLETE;
-- 
gitgitgadget
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help