aboutsummaryrefslogtreecommitdiff
path: root/builtin/verify-pack.c
diff options
context:
space:
mode:
authorJoshua Clayton <stillcompiling@gmail.com>2013-02-22 13:01:18 -0800
committerJunio C Hamano <gitster@pobox.com>2013-02-22 13:18:22 -0800
commit712c6adaeece262121c185a55e83a5074e2a8ea6 (patch)
tree0ba695c1bb79463406d2c1bd52e29e1061f54735 /builtin/verify-pack.c
parent7e2010537e96d0a1144520222f20ba1dc3d61441 (diff)
downloadgit-712c6adaeece262121c185a55e83a5074e2a8ea6.tar.gz
git-712c6adaeece262121c185a55e83a5074e2a8ea6.tar.xz
Git.pm: fix cat_blob crashes on large files
Read and write each 1024 byte buffer, rather than trying to buffer the entire content of the file. We are only copying the contents to a file descriptor and do not use it ourselves. Previous code would crash on all files > 2 Gib, when the offset variable became negative (perhaps below the level of perl), resulting in a crash. On a 32 bit system, or a system with low memory it might crash before reaching 2 GiB due to memory exhaustion. This code may leave a partial file behind in case of failure, where the old code would leave a completely empty file. Neither version verifies the correctness of the content. Calling code must take care of verification and cleanup. Signed-off-by: Joshua Clayton <stillcompiling@gmail.com> Reviewed-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/verify-pack.c')
0 files changed, 0 insertions, 0 deletions