X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=diff-delta.c;h=93385e12baa0d90ae475bd02500edf5ddcce320c;hb=d90b16ed421eb51fc4d7c6bda5f3332cc2e3aece;hp=464ac3ffc0a45e95637e2cecdf97b3d39e5c7933;hpb=71ee7fd15457a0252c089420b5b66de266dcbd2f;p=git.git diff --git a/diff-delta.c b/diff-delta.c index 464ac3ffc..93385e12b 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;