From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7182 invoked by alias); 17 Jul 2017 09:01:50 -0000 Mailing-List: contact cygwin-apps-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: cygwin-apps-cvs-owner@sourceware.org Received: (qmail 7150 invoked by uid 9078); 17 Jul 2017 09:01:49 -0000 Date: Mon, 17 Jul 2017 09:01:00 -0000 Message-ID: <20170717090149.7124.qmail@sourceware.org> From: corinna@sourceware.org To: cygwin-apps-cvs@sourceware.org Subject: [rebase - The rebase tool, core of the automatic rebase facility during postinstall] branch master, updated. a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61 X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: de9e3d8191dd764d8688f70ed8a218d851846f97 X-Git-Newrev: a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61 X-SW-Source: 2017-q3/txt/msg00007.txt.bz2 https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/rebase.git;h=a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61 commit a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61 Author: Corinna Vinschen Date: Mon Jul 17 11:01:41 2017 +0200 handle "out of available DLL slots" condition Signed-off-by: Corinna Vinschen Diff: --- rebase.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/rebase.c b/rebase.c index 9504a48..5b52f76 100644 --- a/rebase.c +++ b/rebase.c @@ -243,7 +243,8 @@ main (int argc, char *argv[]) /* Rebase with database support. */ BOOL header; - merge_image_info (); + if (merge_image_info () < 0) + return 2; status = TRUE; for (i = 0; i < img_info_size; ++i) if (img_info_list[i].flag.needs_rebasing) @@ -745,12 +746,21 @@ merge_image_info () ULONG64 new_base; /* Skip trailing entries as long as there is no hole. */ - while (img_info_list[end].base + img_info_list[end].slot_size + offset - >= floating_image_base) + while (end > 0 + && img_info_list[end].base + img_info_list[end].slot_size + + offset >= floating_image_base) { floating_image_base = img_info_list[end].base; --end; } + /* No hole? We're in serious trouble! */ + if (end <= 0) + { + fprintf (stderr, + "%s: Too many DLLs for available address space: %s\n", + progname, strerror (ENOMEM)); + return -1; + } /* Test if one of the DLLs with address 0 fits into the hole. */ for (i = 0, new_base = 0; img_info_list[i].base == 0; ++i, new_base = 0) {