From f730944a49b2a210bb10520700c0a3f6c49bc020 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Scharfe?= Date: Sat, 15 Jul 2017 20:33:54 +0200 Subject: receive-pack: don't access hash of NULL object_id pointer We set old_oid to NULL if we found out that it's a corrupt reference. In that case don't try to access the hash member and pass NULL to ref_transaction_delete() instead. Found with Clang's UBSan. Signed-off-by: Rene Scharfe Signed-off-by: Junio C Hamano diff --git a/builtin/receive-pack.c b/builtin/receive-pack.c index b1706a5..f589e8a 100644 --- a/builtin/receive-pack.c +++ b/builtin/receive-pack.c @@ -1137,7 +1137,7 @@ static const char *update(struct command *cmd, struct shallow_info *si) } if (ref_transaction_delete(transaction, namespaced_name, - old_oid->hash, + old_oid ? old_oid->hash : NULL, 0, "push", &err)) { rp_error("%s", err.buf); strbuf_release(&err); -- cgit v0.10.2-6-g49f6