git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Martin Koegler <martin.koegler@chello.at>
To: git@vger.kernel.org, gitster@pobox.com, Johannes.Schindelin@gmx.de
Cc: Martin Koegler <martin.koegler@chello.at>
Subject: [PATCH 4/4] Fix delta offset overflow
Date: Thu, 10 Aug 2017 20:13:09 +0200	[thread overview]
Message-ID: <1502388789-5775-2-git-send-email-martin@mail.zuhause> (raw)
In-Reply-To: <1502388789-5775-1-git-send-email-martin@mail.zuhause>

From: Martin Koegler <martin.koegler@chello.at>

Prevent generating delta offsets beyond 4G.

Signed-off-by: Martin Koegler <martin.koegler@chello.at>
---
 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


  reply	other threads:[~2017-08-10 18:13 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-10 18:13 [PATCH 3/4] Convert zlib.c to size_t Martin Koegler
2017-08-10 18:13 ` Martin Koegler [this message]
2017-08-10 20:49   ` [PATCH 4/4] Fix delta offset overflow Junio C Hamano
2017-08-11  6:57     ` Martin Koegler
2017-08-11 18:50       ` Junio C Hamano
2017-08-10 21:52 ` [PATCH 3/4] Convert zlib.c to size_t Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1502388789-5775-2-git-send-email-martin@mail.zuhause \
    --to=martin.koegler@chello.at \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).