[rebase - The rebase tool, core of the automatic rebase facility during postinstall] branch master, updated. a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61
corinna-9JcytcrH/[email protected]
| Newsgroups | gmane.os.cygwin.cvs.apps |
|---|---|
| Message-ID | <[email protected]> |
https://sourceware.org/git/gitweb.cgi?p=cygwin-apps/rebase.git;h=a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61 commit a7d415a25c1b902a98dbc2b0e2fd8928b58e3f61 Author: Corinna Vinschen <[email protected]> Date: Mon Jul 17 11:01:41 2017 +0200 handle "out of available DLL slots" condition Signed-off-by: Corinna Vinschen <[email protected]> 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) {