summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2010-09-01 13:56:10 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2010-09-01 13:56:10 -0700
commite4f8fce5c18c9544d3f1a07929fc14e7cbddbcc3 (patch)
treec37c62045b48dce5285d9ef030aa070bd46940fb
parentMerge branch 'dj/fetch-tagopt' into maint (diff)
parentfix >4GiB source delta assertion failure (diff)
downloadtgif-e4f8fce5c18c9544d3f1a07929fc14e7cbddbcc3.tar.xz
Merge branch 'np/maint-huge-delta-generation' into maint
* np/maint-huge-delta-generation: fix >4GiB source delta assertion failure
-rw-r--r--diff-delta.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/diff-delta.c b/diff-delta.c
index 464ac3ffc0..93385e12ba 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -146,7 +146,14 @@ struct delta_index * create_delta_index(const void *buf, unsigned long bufsize)
/* Determine index hash size. Note that indexing skips the
first byte to allow for optimizing the Rabin's polynomial
initialization in create_delta(). */
- entries = (bufsize - 1) / RABIN_WINDOW;
+ entries = (bufsize - 1) / RABIN_WINDOW;
+ if (bufsize >= 0xffffffffUL) {
+ /*
+ * Current delta format can't encode offsets into
+ * reference buffer with more than 32 bits.
+ */
+ entries = 0xfffffffeU / RABIN_WINDOW;
+ }
hsize = entries / 4;
for (i = 4; (1u << i) < hsize && i < 31; i++);
hsize = 1 << i;