summaryrefslogtreecommitdiff
path: root/diff-delta.c
diff options
context:
space:
mode:
authorMartin Koegler <martin.koegler@chello.at>2017-08-10 18:13:09 (GMT)
committerJunio C Hamano <gitster@pobox.com>2017-08-11 22:25:40 (GMT)
commitfed1ef9550d528dffa8891e8b2f49b486c7985bc (patch)
tree26ad49a73baf47b9ef13f55980a6c9303e7d9904 /diff-delta.c
parent4274c698f46a9bc45834c4904e7e113450c042fb (diff)
downloadgit-fed1ef9550d528dffa8891e8b2f49b486c7985bc.zip
git-fed1ef9550d528dffa8891e8b2f49b486c7985bc.tar.gz
git-fed1ef9550d528dffa8891e8b2f49b486c7985bc.tar.bz2
diff-delta: do not allow delta offset truncation
Prevent generating delta offsets beyond 4G, as the xdelta used in the pack format cannot represent such large offset. Signed-off-by: Martin Koegler <martin.koegler@chello.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'diff-delta.c')
-rw-r--r--diff-delta.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/diff-delta.c b/diff-delta.c
index 3797ce6..ea710c4 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -452,6 +452,9 @@ create_delta(const struct delta_index *index,
moff += msize;
msize = left;
+ if (moff > 0xffffffff)
+ msize = 0;
+
if (msize < 4096) {
int j;
val = 0;