Web lists-archives.com

[PATCH 4/4] Fix delta offset overflow




From: Martin Koegler <martin.koegler@xxxxxxxxx>

Prevent generating delta offsets beyond 4G.

Signed-off-by: Martin Koegler <martin.koegler@xxxxxxxxx>
---
 diff-delta.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/diff-delta.c b/diff-delta.c
index 3d5e1ef..633883e 100644
--- a/diff-delta.c
+++ b/diff-delta.c
@@ -454,6 +454,9 @@ create_delta(const struct delta_index *index,
 			moff += msize;
 			msize = left;
 
+			if (moff > 0xffffffff)
+				msize = 0;
+
 			if (msize < 4096) {
 				int j;
 				val = 0;
-- 
2.1.4