summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: cec21ca)
raw | patch | inline | side by side (parent: cec21ca)
author | Shawn O. Pearce <spearce@spearce.org> | |
Wed, 10 Jan 2007 01:04:52 +0000 (20:04 -0500) | ||
committer | Junio C Hamano <junkio@cox.net> | |
Wed, 10 Jan 2007 01:54:25 +0000 (17:54 -0800) |
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 <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
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 <spearce@spearce.org>
Signed-off-by: Junio C Hamano <junkio@cox.net>
http-fetch.c | patch | blob | history | |
http-push.c | patch | blob | history |
diff --git a/http-fetch.c b/http-fetch.c
index fe8cd7bdcd18748d9dac839e3298a16f85d91007..67dfb0a0337b63bd4c1ef5b9d3228735bf66f1b3 100644 (file)
--- a/http-fetch.c
+++ b/http-fetch.c
return error("Unable to start request");
}
+ target->pack_size = ftell(packfile);
fclose(packfile);
ret = move_temp_to_file(tmpfile, filename);
diff --git a/http-push.c b/http-push.c
index 7e73eac9c3476053c337a361106397c35ae3ee79..0a15f5378288992826e7042a3b9dff92fef4c080 100644 (file)
--- a/http-push.c
+++ b/http-push.c
request->url, curl_errorstr);
remote->can_update_info_refs = 0;
} else {
+ off_t pack_size = ftell(request->local_stream);
+
fclose(request->local_stream);
request->local_stream = NULL;
if (!move_temp_to_file(request->tmpfile,
request->filename)) {
target = (struct packed_git *)request->userData;
+ target->pack_size = pack_size;
lst = &remote->packs;
while (*lst != target)
lst = &((*lst)->next);