From 7371c195ff6c48f489a5bd496a0bbcb9a180a770 Mon Sep 17 00:00:00 2001 From: "Markus F.X.J. Oberhumer" Date: Wed, 16 Mar 2005 01:20:01 +0000 Subject: [PATCH] Allocate larger xtrasize based on ih.datasize. committer: mfx 1110936001 +0000 --- src/p_w32pe.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index f6f40717..d10edb27 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -1660,7 +1660,7 @@ void PackW32Pe::pack(OutputFile *fo) handleStub(fi,fo,pe_offset); const unsigned usize = ih.imagesize; - const unsigned xtrasize = 65536+IDSIZE(PEDIR_IMPORT)+IDSIZE(PEDIR_BOUNDIM)+IDSIZE(PEDIR_IAT)+IDSIZE(PEDIR_DELAYIMP)+IDSIZE(PEDIR_RELOC); + const unsigned xtrasize = UPX_MAX(ih.datasize, 65536u) + IDSIZE(PEDIR_IMPORT) + IDSIZE(PEDIR_BOUNDIM) + IDSIZE(PEDIR_IAT) + IDSIZE(PEDIR_DELAYIMP) + IDSIZE(PEDIR_RELOC); ibuf.alloc(usize + xtrasize); // BOUND IMPORT support. FIXME: is this ok?