🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2501

[PATCH 1/2] unpack-objects: pass the size of a streamed blob as size_t

#2501
From: "Kristofer Karlsson via GitGitGa...
Date: Fri, 06 Nov 2026 12:51
39 lines
12104 bytes
From: Kristofer Karlsson <krka@spotify.com>

Since f2063855fb (index-pack, unpack-objects: use size_t for object
size, 2026-05-08), unpack_one() decodes the size of an object into a
size_t.  But stream_blob(), which is used for blobs larger than
core.bigFileThreshold, still takes that size as "unsigned long".
Where that type is only 32 bits wide, such as on Windows, the size of
a blob larger than 4GB is truncated, and writing the object fails:

  fatal: write stream object 4294967304 != 8

This was found by the next commit, which makes t5608 actually
exercise the unpack-objects path for a >4GB blob.

Take the size as size_t instead.  The struct odb_stream it is stored
in already uses size_t, as does the rest of the path that writes the
loose object.

Signed-off-by: Kristofer Karlsson <krka@spotify.com>
---
 builtin/unpack-objects.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/builtin/unpack-objects.c b/builtin/unpack-objects.c
index 351948724a..d2f25bed49 100644
--- a/builtin/unpack-objects.c
+++ b/builtin/unpack-objects.c
@@ -386,7 +386,7 @@ static ssize_t zlib_stream_read(struct odb_stream *in_stream,
 	return buf_len - zstream->avail_out;
 }
 
-static void stream_blob(unsigned long size, unsigned nr)
+static void stream_blob(size_t size, unsigned nr)
 {
 	git_zstream zstream = { 0 };
 	struct zlib_stream in_stream = {
-- 
gitgitgadget
Technical Details
Message-ID: <789bb9bca7f4a1c97cfd7a1062d80698cd3e11fc.1793969476.git.gitgitgadget@gmail.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74659-linux-kernel-git=dewy.ru
References: <pull.2299.git.1793969476.gitgitgadget@gmail.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!usenet.network!.POSTED!vger.kernel.org!git+bounces-74659-linux-kernel-git=dewy.ru
From: gitgitgadget@gmail.com ("Kristofer Karlsson via GitGitGadget")
Newsgroups: linux.kernel.git
Subject: [PATCH 1/2] unpack-objects: pass the size of a streamed blob as
 size_t
Date: Fri, 06 Nov 2026 12:51:15 +0000
Organization: Usenet Network
Message-ID: <789bb9bca7f4a1c97cfd7a1062d80698cd3e11fc.1793969476.git.gitgitgadget@gmail.com>
References: <pull.2299.git.1793969476.gitgitgadget@gmail.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="3881984"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:avqOWSmvHlnWFeBIF4mGf1uMijA= sha256:XofclHuoCJ4EWTa3hYAnUANLQ38NazdpnatHViFHhr4=
	sha1:/beK1rbPfLHa1AbaJaXT1L3muKE= sha256:Ou/XH+MYhTE7ze1X2P36L3IUTvKdyjvytnko+BgNtSc=
List-ID: <git.vger.kernel.org>
X-Mailpost-Empty-Hdrs: X-Spam-Level
X-Received: from localhost (localhost [127.0.0.1])
	by mail.dewy.ru (Postfix) with ESMTP id D7898113255; Fri,  6 Nov 2026 15:56:43 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.949
X-Spam-Status: No, score=-1.949 tagged_above=-9999 required=6.31
	tests=[DCC_CHECK=1.1, DCC_REPUT_70_89=0.1, DKIM_SIGNED=0.1,
	DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.001,
	FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.249,
	MAILING_LIST_MULTI=-1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001,
	SPF_PASS=-0.001] autolearn=ham autolearn_force=no
X-Authentication-Results: mail.dewy.ru (amavisd-new); dkim=pass (2048-bit key)
	header.d=gmail.com
X-Received: from mail.dewy.ru ([127.0.0.1])
	by localhost (mail.dewy.ru [127.0.0.1]) (amavisd-new, port 10024)
	with ESMTP id ch1V_tMVPGlc;
	Fri,  6 Nov 2026 15:56:37 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74659-linux-kernel-git=dewy.ru@vger.kernel.org; receiver=<UNKNOWN> 
X-Authentication-Results: OpenDMARC; dmarc=fail (p=none dis=none) header.from=gmail.com
X-Received: from sea.lore.kernel.org (sea.lore.kernel.org [172.234.253.10])
	by mail.dewy.ru (Postfix) with ESMTPS id 91335113252; Fri,  6 Nov 2026 15:56:28 +0300 (MSK)
X-Received: from smtp.subspace.kernel.org (conduit.subspace.kernel.org [100.77.114.92])
	by sea.lore.kernel.org (Postfix) with ESMTP id DC2432E1AC; Fri,  6 Nov 2026 12:51:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org; arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-ARC-Seal: i=2; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=pass;
	t=1793969480;
	b=qIpKLsbyLCsE4KA7WiPGCASw2YcsPSBwl+E0V47PtOTsQGFMLJRK6VLTR2ulkHFTXRL7
	 dXwkom1h4PQM4sa8+tcq851fRmEkqZuwpHfyQlIq0hdqEUQZO7Ry6bnUb0eN/qeHJqHwc
	 Fkr5AZwgxb2c6nwqeon9PyHSS8zMZzbLpVpPtSN6XzKm3uA/8Y0tU3hfia+2o0gimmKf1
	 hpPzDV0f8lrSnIhLOseX2B1UaJsT+aY89v7T2QtwJXoNZz68xdKhI73dKSRRYmKQ38Qgq
	 cfTpAuVFMY7SQkJdrV3/YFeQmZ87vjJqlmI51QMjfSGyoUk+1N8imS5PrP2+1q7jnDA==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793969480;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:Message-Id:In-Reply-To:References:From:Date:Subject:Fcc:
	 Content-Type:Content-Transfer-Encoding:X-Mailing-List:List-Id:
	 List-Post:List-Help:List-Subscribe:List-Unsubscribe:List-Owner:
	 Precedence:MIME-Version:To:Cc;
	bh=1D2EouQN1l+x3lhp1vH8uEt1RDOW4S6D2DmQ6eysuJQ=;
	b=TiwVHrofiGxSpswySguJ6a4J3nT60ZYo8ro6R5sImsihwGBKu30yv8LURO91nH5OXHeM
	 HWnDTkc6IYo06dHddaLj2Jz9bIZF8o5PCJUisJfJSgkRp72+EhkrOQSNUDCriRJARnbWm
	 dTP68vNEbunB1DUrvIihoUlvOlzS8rtA2SF06QJKviTUIWdTKc3vUToeu5YZSTaDpOT8x
	 dnm+3Izja6sRnB/JTLlHHTNlG7D9FowBgGYXrzmOFef/sAVPSx8WhTq9G1df0nQk1i4Wv
	 jYVvAgXyRHK6hcS7cdaSfOPC3A69/zerwI2zDtgV3xl5JvYa8eNNbNCTVKHopeu0N6Q==
X-ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; 
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=LIWEPqka;
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	arc=pass header.oldest-pass=0 smtp.remote-ip=127.0.0.1
X-Received: from localhost.localdomain (localhost [127.0.0.1])
	by smtp.subspace.kernel.org (Postfix) with ESMTP id B3690606A336;
	Fri,  6 Nov 2026 12:51:20 +0000 (UTC)
X-Authentication-Results: smtp.subspace.kernel.org;
	dkim=pass (2048-bit key, unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=LIWEPqka
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.222.175
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793969479;
	b=EZnVkc+veS1HKj12AZxnLVLj+KCIpwPf6Uy1OSbRQXhVUWFhY14NQn39l0v6ZPzfGrXV
	 AqAPJG8yavJhUD+2qtJ8br72cwsl4Tsn2jMQ2TDfMGhpAjcxOIr96JhQjPGqUvwE+vC5c
	 LhW7bvX42uTcIFrTJDIoASMfbEjdByJoR1xN15ssQXsM7Bkce2vqf8UTXQfpk1fpm9pAy
	 ERWDbVKypbQ+lR06mP/X/NbQWAnqUwp2GkKMZo/RdRdWkZrcpyIxcN+dCx29g0uDtfgMk
	 UBZN43M079pJmUlgm1thBOMgqHKVFQ5F1FzZodommmKcjOrQ+BmkXuUbXOFwx/cjl3w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793969479;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:Message-Id:In-Reply-To:
	 References:From:Date:Subject:Fcc:Content-Type:
	 Content-Transfer-Encoding:MIME-Version:To:Cc;
	bh=1D2EouQN1l+x3lhp1vH8uEt1RDOW4S6D2DmQ6eysuJQ=;
	b=Fgvt/tSTvo5HuyiefXBctk63ns9mNyMVKydkYd2DWJKNGA0LmGmi4M6MHQuK7eEl+iJO
	 7zaOKuV8qMda+vqxdP3QGpkXvvloX1ZYlrloPEJ/G9HSHHAIFiQs5rl2CW5ArraunyQHC
	 fFJv+5vJo/3WnWULIlTijis/sOXo42M1MfmnJHio3K1Kuj85tqkQjLU3GozrqtG2a6MFL
	 +9tvZfAWG0KF1Hi5ZdGoDozQvEIaRbtr4mGsyyvXApR4JjIPRrN6rIO0baEQYT+KUyDvM
	 j8vcVizX9bxl7IXYMfrGoXQKzVJxSuOjecfI+XoBBeYxaM3UyTIkhW5j0BO5kSmZf+Q==
X-ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; 
	dmarc=pass header.from=gmail.com;
	spf=pass smtp.mailfrom=gmail.com;
	dkim=pass header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20260707 header.b=LIWEPqka;
	arc=none smtp.remote-ip=209.85.222.175
X-Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175])
	(using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)
	 key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256)
	(No client certificate requested)
	by smtp.subspace.kernel.org (Postfix) with ESMTPS id 7BC5E606A331
	for <git@vger.kernel.org>; Fri,  6 Nov 2026 12:51:19 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 7BC5E606A331
X-Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com
X-Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com
X-Received: by mail-qk1-f175.google.com with SMTP id af79cd13be357-945ae2daa68so78585085a.1
        for <git@vger.kernel.org>; Fri, 06 Nov 2026 04:51:19 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793969478; x=1794574278; darn=vger.kernel.org;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:references:in-reply-to:message-id:from:to:cc
         :subject:date:message-id:reply-to:content-type;
        bh=1D2EouQN1l+x3lhp1vH8uEt1RDOW4S6D2DmQ6eysuJQ=;
        b=LIWEPqkapzu49fAT+5HFHgbJIlaCAul+1VjQicHtdzvSgXipDr5GsltfYj8Wc0dtSU
         HZ/2p4IZMWNjz0fiTUbJYx7L4kF+uyB/hky0tfmsYBx2W679vZMXpHPgl7sJWS/aiKhA
         OuuWmbDEococ6IrvqtaLirXu4RrOnh7FMoQ66hUxfdd0FR0ScK4XKRgCcyuMpd5YybU0
         OuxKWNwYHu3/5QXUbXWCl6SXBknmbvsxFVvYvEbWhP3YOZBAKXSTtaxQxTLmkmc4BWw8
         wIIqtRBgkW2LxPiungePmc7KbnYAvK3d3c9SXhUysEFJupM33hQA+WtVczjZbIxJ4GjX
         I49A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793969478; x=1794574278;
        h=cc:to:mime-version:content-transfer-encoding:content-type:fcc
         :subject:date:from:references:in-reply-to:message-id:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=1D2EouQN1l+x3lhp1vH8uEt1RDOW4S6D2DmQ6eysuJQ=;
        b=mIlPSTB6m65FXwa32U3X6BAdbBREspwsSEBQrWKR/0WYe0XXH7aLaTMlNbFkyeyUqA
         9qwibbjbcqB0Wlhey25O/riSSHZ8+XVgcNqsRRT8S9FYpfsD+iGrB/p8STiMm02tqX16
         FjKW1ItJCVX475hVtPlBJotaL57W8p+1E0Yd33B8h3GsuncNK788E8szq4VIGWoZ3rlk
         z4NwG588viBukbFM9tR/TdZg7yWomhJNsQJyik3hc9264E4iAFcWDe+WqGang2rz+MF1
         TQ2GUEPV41YOYBx/1j9hKeeC6IzTuIafBJG5vqmIc0SUDAuVANFF6C5ZC+bvPPfweoXE
         Cx7g==
X-Gm-Message-State: APuU4Z+ERaOLtU6wjegillIpxBRNrVFP/eDrB0o7X8XF2s3M9RgAAajo
	fs2bVa6hxkYp5RlZ0wPEjEt2calbE9W9Z1GEba5bIN3la0Et2jIDcloTRxqWNPK3
X-Gm-Gg: AYBFou3DOvKltc1zXOa62RnMRkbLx6PiNi+wCTrt0MALPkN+NMjDG+s5o9LeADx3qTi
	fhISiR1epa7vKQbk20Qu82NObq9T+t/JMkiYnKSfA9mrDj9LOybzPlBtyUxZ57qZlFeXAraovI5
	87JaydiURF91ukLTURn8WC7abV/N38IDmULzBoRGoa6FgvjXP+kJAyC6mzzlARvrsYcWYX+93u+
	dpuDM/mNyQLrPFA3nWe29ePFGeGJ4nGk40YUHYgw/lLVrZpeRyhZidsa45bL4LT8N6o4ztQU3eZ
	tvZaKcWNXIT5GQrZqAK5qxnmgi0797IAz10vrfgHj2/CzXKUNLvuviT2GgK+Lw2ZxxxpYNQnL25
	5DLq7I4hngOsFV6oE86Zre59WQ1Wlk2mmAUpdVUyObSSg51RQ6ShfnMaxOajXtuRUgtYt/yGzou
	Zhx05doLbZyltcPRyIAocGSDN7FtBFSxihlC6DOQhCgMkhWjPNrwfHMyFeUgcNfhQGJx2q4i4EY
	+ZIAx4p8DuwWgB4a0M/7VgsSjmDVwuOoMFQGmdl6tUaU+g/GGURL+Yrt+VfITErn78HvOM1jz8V
	WbizCwtPqMe+beg4uc7NlLoatTopMKg=
X-Received: by 2002:a05:620a:2788:b0:943:e872:f521 with SMTP id af79cd13be357-945e16aa3d0mr773861285a.9.1793969478368;
        Fri, 06 Nov 2026 04:51:18 -0800 (PST)
X-Received: from [127.0.0.1] ([20.55.15.233])
        by smtp.gmail.com with ESMTPSA id af79cd13be357-945f58bf0f1sm136951785a.5.2026.11.06.04.51.17
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Fri, 06 Nov 2026 04:51:17 -0800 (PST)
X-In-Reply-To: <pull.2299.git.1793969476.gitgitgadget@gmail.com>
X-Fcc: Sent
X-Mailing-List: git@vger.kernel.org
X-List-Post: <mailto:git@vger.kernel.org>
X-List-Help: <mailto:git+help@vger.kernel.org>
X-List-Subscribe: <mailto:git+subscribe@vger.kernel.org>
X-List-Unsubscribe: <mailto:git+unsubscribe@vger.kernel.org>
X-List-Owner: <mailto:git+owner@vger.kernel.org>
X-Precedence: list
X-Cc: Johannes Schindelin <johannes.schindelin@gmx.de>,
    Kristofer Karlsson <krka@spotify.com>,
    Kristofer Karlsson <krka@spotify.com>