πŸš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: linux.kernel.git
Article #2061

[PATCH 0/2] archive, apply: do not truncate files of 4GiB or more

#2061
From: Elia Pinto
Date: Sun, 01 Nov 2026 09:19
42 lines
12085 bytes
Two more cases where, on platforms where "long" is 32 bits but size_t
is 64 bits (64-bit Windows), a file of 4GiB or more is written truncated
or corrupt without any error.

- 1/2 archive: tar and zip of a file written by streaming come out
  corrupt.
- 2/2 apply: the file being patched is written truncated with exit 0
  (also with --index and git am).

No new tests; both were verified by simulating the truncation at 16
bits, as described in the messages.

Regarding t5004, the existing test "zip archive with files bigger than
4GB" has been excluded where "long" is 32 bits (LONG_IS_64BIT) since
2017, because back then the object database couldn't read objects that
large. Today on 64-bit Windows it can, and with this series zip works
too. Thus, the guard could become SIZE_T_IS_64BIT to enable a real test
on Windows. Since I haven't run it on Windows, I'm offering this as a
follow-up or asking reviewers for an opinion.

With this series, the search for these truncations is finished. The
remaining warnings are not reachable: a 4GiB index, sizes bounded by
config or by the format, commits over 4GiB that already die.

It doesn't depend on the other series in flight and merges cleanly with
them. Based on master 50fe5cc63f.

Elia Pinto (2):
  archive: use size_t for the size of archive entries
  apply: use size_t for the size of the result written out

 apply.c       |  8 ++++----
 archive-tar.c | 10 +++++-----
 archive-zip.c | 16 ++++++++--------
 archive.h     |  2 +-
 4 files changed, 18 insertions(+), 18 deletions(-)


base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
-- 
2.53.0
Technical Details
Message-ID: <cover.1793524457.git.gitter.spiros@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-74059-linux-kernel-git=dewy.ru

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-74059-linux-kernel-git=dewy.ru
From: gitter.spiros@gmail.com (Elia Pinto)
Newsgroups: linux.kernel.git
Subject: [PATCH 0/2] archive, apply: do not truncate files of 4GiB or more
Date: Sun,  1 Nov 2026 10:19:21 +0100
Organization: Usenet Network
Message-ID: <cover.1793524457.git.gitter.spiros@gmail.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Injection-Info: usenet.network;
	logging-data="2658928"; mail-complaints-to="abuse@usenet.network"
Cancel-Lock: sha1:gbTPo27+mimlGIVAAKtANg4D7kc= sha256:+1FekeBF+F0rER+jGQrzPxlD62D+GGsvYngw7rCUpO4=
	sha1:qAO7j8OHRUj4DNbMvuF8Kq3Ycxs= sha256:k5UkYekxbaA3rH1oAZYxvBthE2vWagWes5pEV+0j0M0=
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 A4DF4DF9CB; Sun,  1 Nov 2026 12:19:47 +0300 (MSK)
X-Virus-Scanned: Debian amavisd-new at usenet.network
X-Spam-Flag: NO
X-Spam-Score: -1.948
X-Spam-Status: No, score=-1.948 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.25,
	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 2zCvfRLZ2v6U;
	Sun,  1 Nov 2026 12:19:45 +0300 (MSK)
X-Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=172.234.253.10; helo=sea.lore.kernel.org; envelope-from=git+bounces-74059-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 1BC45114002; Sun,  1 Nov 2026 12:19:36 +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 D85D827526; Sun,  1 Nov 2026 09:19:31 +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=1793524770;
	b=GTWWaaXLpkHrDjEwE0MFjxuddEtXg10zJc396xi97kORb1Y56YaFrEhRCq5hOVWo2Ug8
	 8cTEG+KD5GUCZ9p/+XC6DIyxy92PB1iNackrlHTUR6xAp1n571F6iAAcw/c3HJYUM68Bq
	 TzCqas1yI4U/n1LkLlarMlTgi8eX+jBu3MHsIAwsEdIrseAX7VIgP1BTJgmj8G/p0p0Q0
	 vzVZSISHopmVc6G8/Ep9pjCHVufF35bqHJ+zVyzNR2n2L9ZYEM5Hci+AyUJ2nN/QWUmwU
	 yxhnFFZUz5PbERqrOXDC/wwmNlTwumoz7ZLyvCAnXo9I10RmBtLRlYrQ4arNkjMS31A==
X-ARC-Message-Signature: i=2; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793524770;
	h=X-Original-To:Received:DMARC-Filter:Received:DKIM-Signature:
	 X-Google-DKIM-Signature:X-Gm-Message-State:X-Gm-Gg:X-Received:
	 Received:From:To:Cc:Subject:Date:Message-ID:X-Mailer:X-Mailing-List:
	 List-Id:List-Post:List-Help:List-Subscribe:List-Unsubscribe:
	 List-Owner:Precedence:MIME-Version:Content-Transfer-Encoding;
	bh=FaW7MJlXz0YstGhZ7bIibR+mQfiRpmP8qv6qPV2HshM=;
	b=FU7mB1QJlvHosvnpBtcP2y515GXgRuWEry2zNTgcwb8wQ384m4kqQ85CRP2ivnHcm/Rs
	 XEF/8NjxeYmv/0GQOhaHVYDuqZJglE52aIYGpIvAO4oqW88EIhkR7ZUL3majGt4qa0tbw
	 /gAdg1kU9dygcZKDB3eX5POod508r57u0tqfsYJNrmTrTEoYbl+9q8lM8nnh3qxFpEtps
	 ry/AK9rY8aNM8wUf1n1tlLra2VqXnDOcutD9pawbqN5VFZuXJFEIWcqxeB+bnxAbmqwXZ
	 Why9ChZzxLkjEuLtcr1KxIdl7LfkSSK1e5z+2HT7XaEu2CzTAg5mMIF1kSv8PNbk9jA==
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=GbHx5rAZ;
	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 3AD7C606A32E;
	Sun,  1 Nov 2026 09:19:30 +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=GbHx5rAZ
X-Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=209.85.221.46
X-ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none;
	t=1793524769;
	b=QSOyeXf/rPtsBADIaXQQekLms74Ai1bBaym+U1jgZU0xpBU7PRnyxhNWE4Pw6p5j/7SD
	 3iqQ0ifu4pmjCBDdqQmLkXVtNIct8/bo5X84jPBGOt0MAypEUNtCjHHuhvUAoVPS/Yiq0
	 810FBygy6388IXzQbFulYEyM8yjwwlPgIZJhz0xPwOgoSFlti+8BOqBlBUAkbjN08crZG
	 d/a8EEVb41r1aW2A/OUBQya2yznVS0xx3FICtGVNCekA/eidAQLXWN7o55Rf4rNdhQID9
	 WgWS9tZ71jD2twRfIzHBwXfduqp8pyWtTPcxo+h+nIMs+2WUM3AloNWtAqAScOK1m4w==
X-ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015;
	a=rsa-sha256; c=relaxed/relaxed; t=1793524769;
	h=DMARC-Filter:Received:DKIM-Signature:X-Google-DKIM-Signature:
	 X-Gm-Message-State:X-Gm-Gg:X-Received:Received:From:To:Cc:Subject:
	 Date:Message-ID:X-Mailer:MIME-Version:Content-Transfer-Encoding;
	bh=FaW7MJlXz0YstGhZ7bIibR+mQfiRpmP8qv6qPV2HshM=;
	b=AbGiO9k5xMjBW2O+sXtWGa9nk6xO1+bE7WkepNYKewcKRqXdCfEqsHc/S9CKAUOpyivp
	 s5Kk44nPIxzlSSPjoeZf+W+CA4ajB27XJFMStdzT4NoU4YJknYJqUvwIE1m/5f2m46TFS
	 TpBAOdHobAZYnsEQy6hD4CJZW1HxTFnx4+9E5zWDMjdp6b+Dj/UVM5rZqv8nSw8y0NIFq
	 B8E+rJBbcfmS3l/mngpp/a7SBj89vwh1n8eulkGB/lH4HZzFJdlwdwHQU6A8YrsJYfief
	 W1oQB07y4QcJyCl+37FMhFJ2lPGDfo3woIaCpq6fOSOiJ+E1PY8OiUX7grkqq901LOw==
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=GbHx5rAZ;
	arc=none smtp.remote-ip=209.85.221.46
X-Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com [209.85.221.46])
	(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 0132A606A324
	for <git@vger.kernel.org>; Sun,  1 Nov 2026 09:19:28 +0000 (UTC)
X-DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 0132A606A324
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-wr1-f46.google.com with SMTP id ffacd0b85a97d-48e20edd106so1594814f8f.1
        for <git@vger.kernel.org>; Sun, 01 Nov 2026 01:19:28 -0800 (PST)
X-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1793524767; x=1794129567; darn=vger.kernel.org;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:from:to:cc:subject:date:message-id:reply-to:content-type;
        bh=FaW7MJlXz0YstGhZ7bIibR+mQfiRpmP8qv6qPV2HshM=;
        b=GbHx5rAZkmPqYGHySDNp8WoLOL+4DRS/bOOv6KNCSwSLFKpvIXkcF9eV152v5zYOSn
         p5l1rRuO2IvZVCX3qXON+QgIE+T31o3sgiI+9AOzRjz1pQsmzTTG4Ydzp9JYhYf6NhRS
         KdDKPQTb85z+Em8RvF67Lv3Ysy20MuWaTgRuKki93RCA+mipQXnKm6n/K3ybt45l1EYH
         MtBDtCo1OlAvpZDj9xTf46zoqNmmiXcW7AZ8thhNGceb5p+e6bpaLJmqxe7KYoNSOwt8
         lpBtGmhLXDi51EjVYvCDNO7RCsRFRrNkU4KP2Fp72XdQ9Z8mhxV4LwbSVSySYP9U93bl
         +4BQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1793524767; x=1794129567;
        h=content-transfer-encoding:mime-version:message-id:date:subject:cc
         :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date
         :message-id:reply-to:content-type;
        bh=FaW7MJlXz0YstGhZ7bIibR+mQfiRpmP8qv6qPV2HshM=;
        b=M7BVXP6k/R/y+y3DfdMZwB8WOhFxLAiBylrl+6sKNEzEWSyBcHIRJ+QZSKQ7Qjpj3O
         drgSeaucPoQJT6QLSHtQATKtkeZ9g47DtxCW+DyP3p4wdzyHUoH7cZniYHjlgHDYT0Up
         9V2ve4BlAuY+IEr8i5f5jK/vZaaS3WHs2xs5SlUeYnZ0SrFhU60DU9hCMzx2L9XmNWDb
         knl+znDBr+V5uHmO7j6yVMJh/DvbF9NtfLoOie84CHuAwNtwz4zssKbynqO5fb0wzcRS
         MTlkWHiFhsld52mQw+/iyYCQozp5vXweV6pV+IrZkQLsOX7gXK1kNpOOxxG5C8vkApGU
         TeNw==
X-Gm-Message-State: APuU4Z8zqc2nVEN2lckniksW+krHNhR7bsNFCMbCUidRnRWKA193aXBg
	L5IylWPqofYCuCfVXjgm6iAfWnHCzxSLa7xX19SVoEk+GUk3Pcp2Bo3aHNqU/hz4
X-Gm-Gg: AYBFou0VsaYXi4kwjSgFyCBHfn5Nz+swPBDCXg6gCW5IJzbzYA3BYJC9dyAoJ09PuLb
	6ZjMnsKHVOZ0bX7CBTQIwMGknAuE1NBSSbArIUbizh62bIYmZyCHFhix99g9PeNVSqrhbq/3lPz
	05tbmubYYxUHePRBGUqlR0RMui7rFew0iCSXV+KNPsxpQryYRjPiRgRUeNn05rZWKA8fh+GJKH7
	MzBPZAkDHFqC4jf3EsprCE+JazZgjre0NKroxpZtyMqmKZx8DsKotvarqRAl7Hw/mOOKPK6lM5s
	rJhGYVJnzdE1N5YcDWxJmglJgA/nFcA3zkScOlAZv9bAjYcN+D16tR9VB+EYc1srTfoq7nlJKmg
	7MDgwvYRMk8FpiOtrtF6R0H0juIi48ZnCLUxWXJtP3chioOn3Gc3q9JsWmTLK1xPoi1PcVdeEuK
	x63DjvxoEPy4X8G447teLtAnnplk9+P/J9fNkRF82hxi9/eLwfGHrMlJrHKeWCj6tEsz4Sq9gKH
	exJYuZWOvEhmsprynygvcPr5VrClL6eDCe2Vem+sHXJu/ObXFsqlLMSLJEUpncSfyCtzSLN2AYc
	jzUdGVEKDLwdlZK6/IOcLt4fbzOZAmdmakA2IHmtFu4RdYg4LyQ9zUQthL3ukXQWsnDwpFfqEAu
	kWwvol6W5
X-Received: by 2002:a05:6000:4559:b0:48e:752b:9f90 with SMTP id ffacd0b85a97d-48e752ba019mr7780885f8f.38.1793524767237;
        Sun, 01 Nov 2026 01:19:27 -0800 (PST)
X-Received: from ubuntu26lts1.example.com ([151.31.213.44])
        by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-48e71b8011csm14859390f8f.31.2026.11.01.01.19.26
        (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
        Sun, 01 Nov 2026 01:19:26 -0800 (PST)
X-Cc: Johannes Schindelin <Johannes.Schindelin@gmx.de>,
	Elia Pinto <gitter.spiros@gmail.com>,
	RenΓ© Scharfe <l.s.r@web.de>,
	"Matthew E. Luallen" <m@sph3r3.com>,
	Junio C Hamano <gitster@pobox.com>
X-Mailer: git-send-email 2.53.0
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