git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 4/4] Fix delta offset overflow

From
Martin Koegler <martin.koegler@chello.at>
Date
Aug 10, 2017, 18:13 UTC
Message-ID
<1502388789-5775-2-git-send-email-martin@mail.zuhause>
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
Previous: Martin KoeglerNext: Junio C Hamano
Message 2 of 6 in “Convert zlib.c to size_t”
  1. 3/4 Convert zlib.c to size_tMartin Koegler, Aug 10, 2017
  2. 4/4 Fix delta offset overflowMartin Koegler, Aug 10, 2017
  3. Junio C HamanoAug 10, 2017
  4. Martin KoeglerAug 11, 2017
  5. Junio C HamanoAug 11, 2017
  6. Junio C HamanoAug 10, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.