From: Dmitry Ivankov Date: Sun, 18 Sep 2011 19:01:46 GMT Subject: [PATCH 1/3] fast-import: die if we produce too many (MAX_PACK_ID) packs 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 --- 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