From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from fout-a5-smtp.messagingengine.com (fout-a5-smtp.messagingengine.com [103.168.172.148]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 2A96B4E77FC for ; Mon, 28 Sep 2026 15:32:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=103.168.172.148 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790609540; cv=none; b=Of/BWgIzw/yE0GxHoqIlsGsnbf2ITCwN4uKTJjRg3y5Dhr8egbiRw11T3EnDKG/y3EvtLpd7WuvLf+OW95Lyxnc9pwrtasUWKgBD3QvCBoAoICGHArO5pC8bzPoSXqg6rQZdX3RBDiwqLiHY928ZjkKMZa8uAQ4o7mzPD5OhIWI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790609540; c=relaxed/simple; bh=0fQAOCP0mygxfLJzhzpBAL/5zJlRqWidXHD1dpUcs+E=; h=From:To:Cc:Subject:In-Reply-To:References:Date:Message-ID: MIME-Version:Content-Type; b=DYDWwmOsmrDpAmdkUXi/kMqOaB9+uJTsYO3UeK2fHCLcZJGTi520VCoyXQjKsTf1zXlZN2iKWH+jgcu9JANo02PW6+pWOLPCsKRQzzQSZrw4QD1uQpFB9k6tRQWN3zs9Hu9lBE08KLU4+D9igGiZaE1TpQeYdUmKYRiWE44V5TE= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com; spf=pass smtp.mailfrom=pobox.com; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b=ienTQzzg; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b=V8pBDudd; arc=none smtp.client-ip=103.168.172.148 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=pobox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pobox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=pobox.com header.i=@pobox.com header.b="ienTQzzg"; dkim=pass (2048-bit key) header.d=messagingengine.com header.i=@messagingengine.com header.b="V8pBDudd" Received: from phl-compute-07.internal (phl-compute-07.internal [10.202.2.47]) by mailfout.phl.internal (Postfix) with ESMTP id 32582EC0169; Mon, 28 Sep 2026 11:32:18 -0400 (EDT) Received: from phl-frontend-02 ([10.202.2.161]) by phl-compute-07.internal (MEProxy); Mon, 28 Sep 2026 11:32:18 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pobox.com; h=cc :cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1790609538; x=1790695938; bh=LzjmbmMxm4l4do3yddFngZXtRsabm8HsROA8QxOBuMk=; b= ienTQzzgFbT0MySVftQ/HExZL9ooDcExWF076K9onMar0s7fJyz0BFNwwcOkhjL0 7fRTTpNwd0wYwHzUfqOlerH6YtYyfpQtCrsofx2Bpf5vNVEynl507noqNzG8KY5c O5hTJ21M3bzVJUGaGr0xYfdDVDerDY+DhjbW8BNX47SUyAecULoI7cdVUndt5b4i molqsuKGuaXQqEdbeIe5jMDVXK5lvRvC/gc24eMafBMi+JSCqLRsYa4aospF/s1/ h9d+8UjOn8YhgcZ/fo+pSJDmDeiPU8hxtOhLS33sh2jf5r1snh8JuDzmgerAbv1s Sy11dxtOsOwj4iz41mhHLw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1790609538; x= 1790695938; bh=LzjmbmMxm4l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HgATlbVXL8/UKB6SFeDFyNu8gqw X-ME-Proxy: Feedback-ID: if26b431b:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Mon, 28 Sep 2026 11:32:16 -0400 (EDT) From: Junio C Hamano To: "D. Ben Knoble" Cc: git@vger.kernel.org, Eli Barzilay , Phillip Wood , Elijah Newren , Patrick Steinhardt , =?utf-8?B?w4Z2YXIgQXJuZmrDtnLDsA==?= Bjarmason , Victoria Dye , Adam Johnson , Jeff King Subject: Re: [PATCH v3 5/5] builtin/stash: merge index in-core In-Reply-To: (D. Ben Knoble's message of "Mon, 28 Sep 2026 08:03:12 -0400") References: Date: Mon, 28 Sep 2026 08:32:15 -0700 Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Precedence: bulk X-Mailing-List: git@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit "D. Ben Knoble" writes: > On Mon, Sep 28, 2026 at 5:40 AM Junio C Hamano wrote: >> >> "D. Ben Knoble" writes: >> >> > + merge_incore_nonrecursive(&o, merge_base, head, merge, >> > + &result); >> > + >> > + oidcpy(&index_tree, &result.tree->object.oid); >> >> This is risky, isn't it? >> >> If there were catastrophic failure (e.g., missing object that were >> involved in the merge), merge_incore_nonrecursive() may stuff -1 to >> result.clean and return without populating result.tree, and when >> that happens, result.tree->object.oid would be dereferencing NULL. > > Indeed… unfortunate. Thanks for spotting. I did $ git grep merge_incore_nonrecursive \*.c and read all the current callers. They all have code to specifically check for the (result.clean < 0) condition and error out before touching any of the other members of the result structure, so they seem to be safe.