]> git.ipfire.org Git - thirdparty/git.git/commit
tree-walk: use size_t consistently
authorJeff King <peff@peff.net>
Wed, 31 Jul 2019 04:38:18 +0000 (00:38 -0400)
committerJunio C Hamano <gitster@pobox.com>
Thu, 1 Aug 2019 20:06:40 +0000 (13:06 -0700)
commit37806080d7be1ab5b2fa918f6a528652596ea2c1
treefb6f260202b9ef1feba1dac3a67d36aeb2ef98e9
parent9055384710dd8963b125f4f87c24d8f67d9fa24f
tree-walk: use size_t consistently

We store and manipulate the cumulative traverse_info.pathlen as an
"int", which can overflow when we are fed ridiculously long pathnames
(e.g., ones at the edge of 2GB or 4GB, even if the individual tree entry
names are smaller than that). The results can be confusing, though
after some prodding I was not able to use this integer overflow to cause
an under-allocated buffer.

Let's consistently use size_t to generate and store these, and make
sure our addition doesn't overflow.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
tree-walk.c
tree-walk.h
unpack-trees.c