From: Elia Pinto <gitter.spiros@gmail.com>
To: git@vger.kernel.org
Cc: "Johannes Schindelin" <Johannes.Schindelin@gmx.de>,
"Elia Pinto" <gitter.spiros@gmail.com>,
"Junio C Hamano" <gitster@pobox.com>,
"Patrick Steinhardt" <ps@pks.im>, "Jeff King" <peff@peff.net>,
"René Scharfe" <l.s.r@web.de>,
"brian m. carlson" <sandals@crustytoothpaste.net>,
"Eric W. Biederman" <ebiederm@xmission.com>,
"Jiang Xin" <zhiyou.jx@alibaba-inc.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
Subject: [PATCH 0/4] use size_t when parsing and checking objects
Date: Sat, 31 Oct 2026 12:09:56 +0100 [thread overview]
Message-ID: <cover.1793444420.git.gitter.spiros@gmail.com> (raw)
This series continues the search for truncated sizes on platforms where
"long" is 32 bits (Windows). It covers the functions that parse, verify,
and check whole objects in memory: they take the size as an "unsigned
long", while their callers have a size_t, so above 4GiB the size gets
truncated.
Each patch addresses a specific component:
- 1/4: a valid object reported as corrupt;
- 2/4: fsck looks at only a prefix (e.g., .gitmodules);
- 3/4: parsing of a prefix (with set_commit_buffer() now dying instead
of caching a truncated size, as repo_get_commit_buffer() already
does);
- 4/4: "git tag -v" doesn't find the signature, plus the int index in
copy_subject() on all platforms.
There are no out-of-bounds accesses; large objects only fail or are
handled as if they were shorter.
No tests are added because they would need objects over 4GiB in memory,
and they'd only detect the bug where long is 32 bits. I am happy to add
EXPENSIVE tests guarded by !LONG_IS_64BIT (like t1051) if reviewers
prefer.
Not covered here: the pack paths (index-pack, unpack-objects, pack
verification) still pass an "unsigned long" to fsck_object(); that's the
next series. The tree API (parse_tree_buffer(), init_tree_desc*()) is in
the tree-walk series:
https://lore.kernel.org/git/cover.1793357680.git.gitter.spiros@gmail.com/
This series doesn't depend on the other series in flight and merges
cleanly with them. Based on master 50fe5cc63f.
Elia Pinto (4):
object-file: use size_t in check_object_signature()
fsck: use size_t for the size of objects to check
object, commit, tag: use size_t when parsing object buffers
tag, fmt-merge-msg, ref-filter: use size_t for message buffers
commit.c | 8 ++++----
commit.h | 6 +++---
fmt-merge-msg.c | 2 +-
fsck.c | 18 +++++++++---------
fsck.h | 6 +++---
object-file-convert.c | 2 +-
object-file.c | 2 +-
object-file.h | 2 +-
object.c | 2 +-
object.h | 2 +-
ref-filter.c | 6 +++---
tag.c | 4 ++--
tag.h | 2 +-
13 files changed, 31 insertions(+), 31 deletions(-)
base-commit: 50fe5cc63f9cd6e89b87a2c9ccf96a444f4cfdb7
--
2.53.0
next reply other threads:[~2026-10-31 11:10 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-31 11:09 Elia Pinto [this message]
2026-10-31 11:09 ` [PATCH 1/4] object-file: use size_t in check_object_signature() Elia Pinto
2026-10-31 11:09 ` [PATCH 2/4] fsck: use size_t for the size of objects to check Elia Pinto
2026-10-31 11:09 ` [PATCH 3/4] object, commit, tag: use size_t when parsing object buffers Elia Pinto
2026-10-31 11:10 ` [PATCH 4/4] tag, fmt-merge-msg, ref-filter: use size_t for message buffers Elia Pinto
2026-10-31 17:06 ` [PATCH 0/4] use size_t when parsing and checking objects Simon Richter
2026-10-31 18:37 ` Elia Pinto
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1793444420.git.gitter.spiros@gmail.com \
--to=gitter.spiros@gmail.com \
--cc=Johannes.Schindelin@gmx.de \
--cc=avarab@gmail.com \
--cc=ebiederm@xmission.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=l.s.r@web.de \
--cc=peff@peff.net \
--cc=ps@pks.im \
--cc=sandals@crustytoothpaste.net \
--cc=zhiyou.jx@alibaba-inc.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.