From 1c23d794bfa3b9f3e03b18bb7e542615a924dbe3 Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Tue, 9 Jan 2007 20:04:52 -0500 Subject: Don't die in git-http-fetch when fetching packs. My sp/mmap changes to pack-check.c modified the function such that it expects packed_git.pack_size to be populated with the total bytecount of the packfile by the caller. But that isn't the case for packs obtained by git-http-fetch as pack_size was not initialized before being accessed. This caused verify_pack to think it had 2^32-21 bytes available when the downloaded pack perhaps was only 305 bytes in length. The use_pack function then later dies with "offset beyond end of packfile" when computing the overall file checksum. Signed-off-by: Shawn O. Pearce Signed-off-by: Junio C Hamano --- http-fetch.c | 1 + 1 file changed, 1 insertion(+) (limited to 'http-fetch.c') diff --git a/http-fetch.c b/http-fetch.c index fe8cd7bdcd..67dfb0a033 100644 --- a/http-fetch.c +++ b/http-fetch.c @@ -809,6 +809,7 @@ static int fetch_pack(struct alt_base *repo, unsigned char *sha1) return error("Unable to start request"); } + target->pack_size = ftell(packfile); fclose(packfile); ret = move_temp_to_file(tmpfile, filename); -- cgit v1.2.1