summaryrefslogtreecommitdiff
path: root/builtin/clone.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2015-06-04 12:35:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2015-06-04 17:28:57 (GMT)
commitf0e7f11d054b79de6e1f7bcee6e68c2f17af61bd (patch)
treecef0b4465c82e4d16ba4100ba5529f83c6f8c47b /builtin/clone.c
parentc6458e60ed0f3e26a1df88bf5a3da8b091b0ce15 (diff)
downloadgit-f0e7f11d054b79de6e1f7bcee6e68c2f17af61bd.zip
git-f0e7f11d054b79de6e1f7bcee6e68c2f17af61bd.tar.gz
git-f0e7f11d054b79de6e1f7bcee6e68c2f17af61bd.tar.bz2
index-pack: fix truncation of off_t in comparison
Commit c6458e6 (index-pack: kill union delta_base to save memory, 2015-04-18) refactored the comparison functions used in sorting and binary searching our delta list. The resulting code does something like: int cmp_offsets(off_t a, off_t b) { return a - b; } This works most of the time, but produces nonsensical results when the difference between the two offsets is larger than what can be stored in an "int". This can lead to unresolved deltas if the packsize is larger than 2G (even on 64-bit systems, an int is still typically 32 bits): $ git clone git://github.com/mozilla/gecko-dev Cloning into 'gecko-dev'... remote: Counting objects: 4800161, done. remote: Compressing objects: 100% (178/178), done. remote: Total 4800161 (delta 88), reused 0 (delta 0), pack-reused 4799978 Receiving objects: 100% (4800161/4800161), 2.21 GiB | 3.26 MiB/s, done. Resolving deltas: 99% (3808820/3811944), completed with 0 local objects. fatal: pack has 3124 unresolved deltas fatal: index-pack failed We can fix it by doing direct comparisons between the offsets and returning constants; the callers only care about the sign of the comparison, not the magnitude. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/clone.c')
0 files changed, 0 insertions, 0 deletions