diff-delta: do not allow delta offset truncation
authorMartin Koegler <martin.koegler@chello.at>
Thu, 10 Aug 2017 18:13:09 +0000 (20:13 +0200)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Aug 2017 22:25:40 +0000 (15:25 -0700)
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>
diff-delta.c
index 3797ce6041981d1facda44d3a95d4448dbb8a091..ea710c44ce6b215176e05f70573ad52a74d6f51e 100644 (file)
@@ -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;