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

[PATCH 1/3] fast-import: die if we produce too many (MAX_PACK_ID) packs

From
Dmitry Ivankov <divanorama@gmail.com>
Date
Sep 18, 2011, 19:01 UTC
Message-ID
<1316372508-7173-2-git-send-email-divanorama@gmail.com>
In-Reply-To
<1316372508-7173-1-git-send-email-divanorama@gmail.com>

In fast-import pack_id is 16-bit with MAX_PACK_ID reserved to identify pre-existing objects. It is unlikely to wrap under reasonable settings but still things in fast-import will break once it happens.

Add a check and immediate die() as the simplest reaction to being unable to continue the import.

Signed-off-by: Dmitry Ivankov <divanorama@gmail.com>
---
 fast-import.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/fast-import.c b/fast-import.c
index 742e7da..907cb05 100644
--- a/fast-import.c
+++ b/fast-import.c
@@ -1009,6 +1009,8 @@ static void end_packfile(void)
 static void cycle_packfile(void)
 {
 	end_packfile();
+	if (pack_id >= MAX_PACK_ID)
+		die("too many (%u) packs produced", pack_id);
 	start_packfile();
 }
 
-- 
1.7.3.4
Previous: Dmitry IvankovNext: Jonathan Nieder
Message 2 of 9 in “fast-import: fix pack_id corner cases”
  1. 0/3 fast-import: fix pack_id corner casesDmitry Ivankov, Sep 18, 2011
  2. 1/3 fast-import: die if we produce too many (MAX_PACK_ID) packsDmitry Ivankov, Sep 18, 2011
  3. Jonathan NiederSep 18, 2011
  4. 2/3 fast-import: fix corner case for checkpointDmitry Ivankov, Sep 18, 2011
  5. Jonathan NiederSep 18, 2011
  6. 3/3 fast-import: rename object_count to pack_object_countDmitry Ivankov, Sep 18, 2011
  7. Jonathan NiederSep 18, 2011
  8. Dmitry IvankovSep 18, 2011
  9. Jonathan NiederSep 18, 2011

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.